[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] cpufreq: Short path avoiding IPI in critical fast path.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1228994869 0
# Node ID 0f1a166fe92e489d0b5e3d3d35bcdb004b20f0eb
# Parent  147c646a28361b19326fc90de79dbbcb7ab83613
cpufreq: Short path avoiding IPI in critical fast path.
Signed-off-by: Liu, Jinsong <jinsong.liu@xxxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/acpi/cpufreq/cpufreq.c |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff -r 147c646a2836 -r 0f1a166fe92e xen/arch/x86/acpi/cpufreq/cpufreq.c
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c       Thu Dec 11 11:19:27 2008 +0000
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c       Thu Dec 11 11:27:49 2008 +0000
@@ -255,17 +255,27 @@ static void  __get_measured_perf(void *p
 
 static unsigned int get_measured_perf(unsigned int cpu)
 {
-    unsigned int retval, perf_percent;
+    struct cpufreq_policy *policy;
+    unsigned int perf_percent;
     cpumask_t cpumask;
 
     if (!cpu_online(cpu))
         return 0;
 
-    cpumask = cpumask_of_cpu(cpu);
-    on_selected_cpus(cpumask, __get_measured_perf, (void *)&perf_percent,0,1);
-
-    retval = drv_data[cpu]->max_freq * perf_percent / 100;
-    return retval;
+    policy = cpufreq_cpu_policy[cpu];
+    if (!policy)
+        return 0;
+
+    /* Usually we take the short path (no IPI) for the sake of performance. */
+    if (cpu == smp_processor_id()) {
+        __get_measured_perf((void *)&perf_percent);
+    } else {
+        cpumask = cpumask_of_cpu(cpu);
+        on_selected_cpus(cpumask, __get_measured_perf, 
+                        (void *)&perf_percent,0,1);
+    }
+
+    return drv_data[cpu]->max_freq * perf_percent / 100;
 }
 
 static unsigned int get_cur_freq_on_cpu(unsigned int cpu)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.