Commit 0c5af7c6 authored by Matthew Dobson's avatar Matthew Dobson Committed by Linus Torvalds

[PATCH] Create cpu_sibling_map for PPC64

In light of some proposed changes in the sched_domains code, I coded up
this little ditty that simply creates and populates a cpu_sibling_map for
PPC64 machines.  The patch just checks the CPU flags to determine if the
CPU supports SMT (aka Hyper-Threading aka Multi-Threading aka ...) and
fills in a mask of the siblings for each CPU in the system.  This should
allow us to build sched_domains for PPC64 with generic code in
kernel/sched.c for the SMT systems.  SMT is becoming more popular and is
turning up in more and more architectures.  I don't think it will be too
long until this feature is supported by most arches...
Signed-off-by: default avatarMatthew Dobson <colpatch@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6f4c30b1
......@@ -59,6 +59,7 @@ unsigned long cache_decay_ticks;
cpumask_t cpu_possible_map = CPU_MASK_NONE;
cpumask_t cpu_online_map = CPU_MASK_NONE;
cpumask_t cpu_sibling_map[NR_CPUS] = { [0 ... NR_CPUS-1] = CPU_MASK_NONE };
EXPORT_SYMBOL(cpu_online_map);
EXPORT_SYMBOL(cpu_possible_map);
......@@ -858,6 +859,12 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
for_each_cpu(cpu)
if (cpu != boot_cpuid)
smp_create_idle(cpu);
for_each_cpu(cpu) {
cpu_set(cpu, cpu_sibling_map[cpu]);
if (cur_cpu_spec->cpu_features & CPU_FTR_SMT)
cpu_set(cpu ^ 0x1, cpu_sibling_map[cpu]);
}
}
void __devinit smp_prepare_boot_cpu(void)
......
......@@ -36,6 +36,8 @@ extern void smp_message_recv(int, struct pt_regs *);
#define smp_processor_id() (get_paca()->paca_index)
#define hard_smp_processor_id() (get_paca()->hw_cpu_id)
extern cpumask_t cpu_sibling_map[NR_CPUS];
/* Since OpenPIC has only 4 IPIs, we use slightly different message numbers.
*
* Make sure this matches openpic_request_IPIs in open_pic.c, or what shows up
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment