Update 2 points of cpufreq 1. change bool to int type so that compatible with some old linux .h file; 2. set a short path for get_measured_perf() for the sake of performance because it lies in key path, called frequently. Signed-off-by: Liu, Jinsong diff -r 810a4d43aaa1 tools/libxc/xc_pm.c --- a/tools/libxc/xc_pm.c Thu Dec 11 13:22:27 2008 +0800 +++ b/tools/libxc/xc_pm.c Thu Dec 11 14:22:50 2008 +0800 @@ -24,8 +24,6 @@ */ #include -#include - #include "xc_private.h" /* @@ -186,9 +184,9 @@ int xc_get_cpufreq_para(int xc_handle, i DECLARE_SYSCTL; int ret = 0; struct xen_get_cpufreq_para *sys_para = &sysctl.u.pm_op.get_para; - bool has_num = user_para->cpu_num && - user_para->freq_num && - user_para->gov_num; + int has_num = user_para->cpu_num && + user_para->freq_num && + user_para->gov_num; if ( (xc_handle < 0) || !user_para ) return -EINVAL; diff -r 810a4d43aaa1 xen/arch/x86/acpi/cpufreq/cpufreq.c --- a/xen/arch/x86/acpi/cpufreq/cpufreq.c Thu Dec 11 13:22:27 2008 +0800 +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c Thu Dec 11 14:22:50 2008 +0800 @@ -270,16 +270,27 @@ static void __get_measured_perf(void *p static unsigned int get_measured_perf(unsigned int cpu) { + struct cpufreq_policy *policy; unsigned int retval, 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; - retval = drv_data[cpu]->max_freq * perf_percent / 100; + /* usually we go short path without 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[policy->cpu]->max_freq * perf_percent / 100; return retval; }