From: Ingo Molnar limit scheduler migration calibration to the affected CPU map. Signed-off-by: Ingo Molnar Cc: John Hawkes Signed-off-by: Andrew Morton --- include/linux/sched.h | 2 -- kernel/sched.c | 10 +++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff -puN include/linux/sched.h~scheduler-cache-hot-autodetect-limit-to-affected-cpu-map include/linux/sched.h --- devel/include/linux/sched.h~scheduler-cache-hot-autodetect-limit-to-affected-cpu-map 2005-12-22 05:09:56.000000000 -0800 +++ devel-akpm/include/linux/sched.h 2005-12-22 05:09:56.000000000 -0800 @@ -638,8 +638,6 @@ extern void partition_sched_domains(cpum */ extern unsigned int max_cache_size; -extern void calibrate_migration_costs(void); - #endif /* CONFIG_SMP */ diff -puN kernel/sched.c~scheduler-cache-hot-autodetect-limit-to-affected-cpu-map kernel/sched.c --- devel/kernel/sched.c~scheduler-cache-hot-autodetect-limit-to-affected-cpu-map 2005-12-22 05:09:56.000000000 -0800 +++ devel-akpm/kernel/sched.c 2005-12-22 05:09:56.000000000 -0800 @@ -5478,7 +5478,7 @@ static unsigned long long measure_migrat return 2 * max_cost * migration_factor / MIGRATION_FACTOR_SCALE; } -void calibrate_migration_costs(void) +static void calibrate_migration_costs(const cpumask_t *cpu_map) { int cpu1 = -1, cpu2 = -1, cpu, orig_cpu = raw_smp_processor_id(); struct sched_domain *sd; @@ -5491,8 +5491,8 @@ void calibrate_migration_costs(void) /* * First pass - calculate the cacheflush times: */ - for_each_online_cpu(cpu1) { - for_each_online_cpu(cpu2) { + for_each_cpu_mask(cpu1, *cpu_map) { + for_each_cpu_mask(cpu2, *cpu_map) { if (cpu1 == cpu2) continue; distance = domain_distance(cpu1, cpu2); @@ -5512,7 +5512,7 @@ void calibrate_migration_costs(void) * Second pass - update the sched domain hierarchy with * the new cache-hot-time estimations: */ - for_each_online_cpu(cpu) { + for_each_cpu_mask(cpu, *cpu_map) { distance = 0; for_each_domain(cpu, sd) { sd->cache_hot_time = migration_cost[distance]; @@ -5946,7 +5946,7 @@ next_sg: /* * Tune cache-hot values: */ - calibrate_migration_costs(); + calibrate_migration_costs(cpu_map); } /* * Set up scheduler domains and groups. Callers must hold the hotplug lock. _