diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-12-11 11:27:49 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-12-11 11:27:49 +0000 |
commit | ecdcad9ec544c3c1c20a39c0766be13ead3e6c2c (patch) | |
tree | bb34292c4d2152936bf38c80abe7c3aeb01e7be8 /xen/arch/x86/acpi/cpufreq/cpufreq.c | |
parent | de8ffdf6a4c4ffeca977836c9a25d11a2a23247f (diff) |
cpufreq: Short path avoiding IPI in critical fast path.
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'xen/arch/x86/acpi/cpufreq/cpufreq.c')
-rw-r--r-- | xen/arch/x86/acpi/cpufreq/cpufreq.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufreq/cpufreq.c index a66dc6dc7f..7f996e4d6f 100644 --- a/xen/arch/x86/acpi/cpufreq/cpufreq.c +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c @@ -255,17 +255,27 @@ static void __get_measured_perf(void *perf_percent) 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); + 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); + } - retval = drv_data[cpu]->max_freq * perf_percent / 100; - return retval; + return drv_data[cpu]->max_freq * perf_percent / 100; } static unsigned int get_cur_freq_on_cpu(unsigned int cpu) |