From: Ingo Molnar Nick Piggin sets cache_hot_time on x86. Activates sched-domains on SMP x86 too. --- 25-akpm/arch/i386/kernel/smpboot.c | 46 ++++++++++++++++++++++++++++++++++- 25-akpm/include/asm-i386/processor.h | 8 +++--- 2 files changed, 50 insertions(+), 4 deletions(-) diff -puN arch/i386/kernel/smpboot.c~sched-x86-cachehot-fix arch/i386/kernel/smpboot.c --- 25/arch/i386/kernel/smpboot.c~sched-x86-cachehot-fix 2004-03-26 12:29:13.718863744 -0800 +++ 25-akpm/arch/i386/kernel/smpboot.c 2004-03-26 12:29:13.723862984 -0800 @@ -1148,9 +1148,11 @@ __init void arch_init_sched_domains(void *phys_domain = SD_CPU_INIT; phys_domain->span = nodemask; + phys_domain->cache_hot_time = cacheflush_time / 2; *node_domain = SD_NODE_INIT; node_domain->span = cpu_possible_map; + node_domain->cache_hot_time = cacheflush_time; } /* Set up CPU (sibling) groups */ @@ -1275,6 +1277,7 @@ __init void arch_init_sched_domains(void *phys_domain = SD_CPU_INIT; phys_domain->span = cpu_possible_map; + phys_domain->cache_hot_time = cacheflush_time / 2; } /* Set up CPU (sibling) groups */ @@ -1339,7 +1342,48 @@ __init void arch_init_sched_domains(void } } #endif /* CONFIG_NUMA */ -#endif /* CONFIG_SCHED_SMT */ +#else /* !CONFIG_SCHED_SMT */ + +static struct sched_group sched_group_cpus[NR_CPUS]; + +__init void arch_init_sched_domains(void) +{ + int i; + struct sched_group *first_cpu = NULL, *last_cpu = NULL; + + /* Set up domains */ + for_each_cpu(i) { + struct sched_domain *cpu_sd = cpu_sched_domain(i); + + *cpu_sd = SD_CPU_INIT; + cpu_sd->span = cpu_possible_map; + cpu_sd->cache_hot_time = cacheflush_time / 2; + } + + /* Set up CPU groups */ + for_each_cpu_mask(i, cpu_possible_map) { + struct sched_group *cpu = &sched_group_cpus[i]; + + cpus_clear(cpu->cpumask); + cpu_set(i, cpu->cpumask); + cpu->cpu_power = SCHED_LOAD_SCALE; + + if (!first_cpu) + first_cpu = cpu; + if (last_cpu) + last_cpu->next = cpu; + last_cpu = cpu; + } + last_cpu->next = first_cpu; + + mb(); + for_each_cpu(i) { + struct sched_domain *cpu_sd = cpu_sched_domain(i); + cpu_sd->groups = &sched_group_cpus[i]; + } +} + +#endif /* These are wrappers to interface to the new boot process. Someone who understands all this stuff should rewrite it properly. --RR 15/Jul/02 */ diff -puN include/asm-i386/processor.h~sched-x86-cachehot-fix include/asm-i386/processor.h --- 25/include/asm-i386/processor.h~sched-x86-cachehot-fix 2004-03-26 12:29:13.719863592 -0800 +++ 25-akpm/include/asm-i386/processor.h 2004-03-26 12:29:13.724862832 -0800 @@ -646,9 +646,11 @@ extern inline void prefetchw(const void extern void select_idle_routine(const struct cpuinfo_x86 *c); -#ifdef CONFIG_SCHED_SMT -#define ARCH_HAS_SCHED_DOMAIN -#define ARCH_HAS_SCHED_WAKE_IDLE +#ifdef CONFIG_SMP +# define ARCH_HAS_SCHED_DOMAIN +# ifdef CONFIG_SCHED_SMT +# define ARCH_HAS_SCHED_WAKE_IDLE +# endif #endif #endif /* __ASM_I386_PROCESSOR_H */ _