ia64/xen-unstable

changeset 18911:0f1a166fe92e

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>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Dec 11 11:27:49 2008 +0000 (2008-12-11)
parents 147c646a2836
children a662a934eefe
files xen/arch/x86/acpi/cpufreq/cpufreq.c
line diff
     1.1 --- a/xen/arch/x86/acpi/cpufreq/cpufreq.c	Thu Dec 11 11:19:27 2008 +0000
     1.2 +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c	Thu Dec 11 11:27:49 2008 +0000
     1.3 @@ -255,17 +255,27 @@ static void  __get_measured_perf(void *p
     1.4  
     1.5  static unsigned int get_measured_perf(unsigned int cpu)
     1.6  {
     1.7 -    unsigned int retval, perf_percent;
     1.8 +    struct cpufreq_policy *policy;
     1.9 +    unsigned int perf_percent;
    1.10      cpumask_t cpumask;
    1.11  
    1.12      if (!cpu_online(cpu))
    1.13          return 0;
    1.14  
    1.15 -    cpumask = cpumask_of_cpu(cpu);
    1.16 -    on_selected_cpus(cpumask, __get_measured_perf, (void *)&perf_percent,0,1);
    1.17 +    policy = cpufreq_cpu_policy[cpu];
    1.18 +    if (!policy)
    1.19 +        return 0;
    1.20  
    1.21 -    retval = drv_data[cpu]->max_freq * perf_percent / 100;
    1.22 -    return retval;
    1.23 +    /* Usually we take the short path (no IPI) for the sake of performance. */
    1.24 +    if (cpu == smp_processor_id()) {
    1.25 +        __get_measured_perf((void *)&perf_percent);
    1.26 +    } else {
    1.27 +        cpumask = cpumask_of_cpu(cpu);
    1.28 +        on_selected_cpus(cpumask, __get_measured_perf, 
    1.29 +                        (void *)&perf_percent,0,1);
    1.30 +    }
    1.31 +
    1.32 +    return drv_data[cpu]->max_freq * perf_percent / 100;
    1.33  }
    1.34  
    1.35  static unsigned int get_cur_freq_on_cpu(unsigned int cpu)