]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
[SPARC64]: Add SMT scheduling support for Niagara.
authorDavid S. Miller <davem@sunset.davemloft.net>
Thu, 9 Mar 2006 00:09:19 +0000 (16:09 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Mon, 20 Mar 2006 09:14:24 +0000 (01:14 -0800)
The mapping is a simple "(cpuid >> 2) == core" for now.
Later we'll add more sophisticated code that will walk
the sun4v machine description and figure this out from
there.

We should also add core mappings for jaguar and panther
processors.

Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc64/Kconfig
arch/sparc64/kernel/smp.c
include/asm-sparc64/smp.h

index a253a39c3ff600c0b00445e67f3fbce81c4fb993..49b652f9b1d829506aba2920ba79abc5ff511234 100644 (file)
@@ -356,6 +356,15 @@ config SOLARIS_EMUL
 
 endmenu
 
+config SCHED_SMT
+       bool "SMT (Hyperthreading) scheduler support"
+       depends on SMP
+       default y
+       help
+         SMT scheduler support improves the CPU scheduler's decision making
+         when dealing with UltraSPARC cpus at a cost of slightly increased
+         overhead in some places. If unsure say N here.
+
 config CMDLINE_BOOL
        bool "Default bootloader kernel arguments"
 
index cf56128097c86d666b105276996f82b33ae649f1..373a701c90a5ae82061028b45bc9733b26a5ac31 100644 (file)
@@ -47,6 +47,8 @@ static unsigned char boot_cpu_id;
 
 cpumask_t cpu_online_map __read_mostly = CPU_MASK_NONE;
 cpumask_t phys_cpu_present_map __read_mostly = CPU_MASK_NONE;
+cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly =
+       { [0 ... NR_CPUS-1] = CPU_MASK_NONE };
 static cpumask_t smp_commenced_mask;
 static cpumask_t cpu_callout_map;
 
@@ -1291,6 +1293,8 @@ int setup_profiling_timer(unsigned int multiplier)
 /* Constrain the number of cpus to max_cpus.  */
 void __init smp_prepare_cpus(unsigned int max_cpus)
 {
+       int i;
+
        if (num_possible_cpus() > max_cpus) {
                int instance, mid;
 
@@ -1305,6 +1309,20 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
                }
        }
 
+       for_each_cpu(i) {
+               if (tlb_type == hypervisor) {
+                       int j;
+
+                       /* XXX get this mapping from machine description */
+                       for_each_cpu(j) {
+                               if ((j >> 2) == (i >> 2))
+                                       cpu_set(j, cpu_sibling_map[i]);
+                       }
+               } else {
+                       cpu_set(i, cpu_sibling_map[i]);
+               }
+       }
+
        smp_store_cpu_info(boot_cpu_id);
 }
 
index ad1d35a7d13f0e344dbf5ddfb3be465e0c29fa2d..89d86ecaab2459ddf168695fb80b11ebdf787ee0 100644 (file)
@@ -33,6 +33,8 @@
 extern cpumask_t phys_cpu_present_map;
 #define cpu_possible_map phys_cpu_present_map
 
+extern cpumask_t cpu_sibling_map[NR_CPUS];
+
 /*
  *     General functions that each host system must provide.
  */