[patch] Re: Bug 619 - sched_best_cpu does not pick best cpu (1/1)

From: Andrew Theurer (habanero@us.ibm.com)
Date: Wed May 14 2003 - 20:29:42 EST


I believe this will work for ppc64:

[root@hearse root]# diffstat patch-nr_cpus_node-ppc64-2.5.69
 arch/ppc64/mm/numa.c | 6 +++++-
 include/asm-ppc64/mmzone.h | 1 +
 include/asm-ppc64/topology.h | 5 +++++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff -Naur 2.5.69-bk-5-8-2003-numa/arch/ppc64/mm/numa.c
2.5.69-bk-5-8-2003-numa-nrcpusnode/arch/ppc64/mm/numa.c
--- 2.5.69-bk-5-8-2003-numa/arch/ppc64/mm/numa.c 2003-05-14 18:11:35.000000000
-0700
+++ 2.5.69-bk-5-8-2003-numa-nrcpusnode/arch/ppc64/mm/numa.c 2003-05-14
18:18:06.000000000 -0700
@@ -25,6 +25,7 @@
 int numa_memory_lookup_table[MAX_MEMORY >> MEMORY_INCREMENT_SHIFT] =
         { [ 0 ... ((MAX_MEMORY >> MEMORY_INCREMENT_SHIFT) - 1)] = -1};
 unsigned long numa_cpumask_lookup_table[MAX_NUMNODES];
+int nr_cpus_in_node[MAX_NUMNODES] = { [0 ... (MAX_NUMNODES -1)] = 0};
 
 struct pglist_data node_data[MAX_NUMNODES];
 bootmem_data_t plat_node_bdata[MAX_NUMNODES];
@@ -33,7 +34,10 @@
 {
         dbg("cpu %d maps to domain %d\n", cpu, node);
         numa_cpu_lookup_table[cpu] = node;
- numa_cpumask_lookup_table[node] |= 1UL << cpu;
+ if (!(numa_cpumask_lookup_table[node] & 1UL << cpu)) {
+ numa_cpumask_lookup_table[node] |= 1UL << cpu;
+ nr_cpus_in_node[node]++;
+ }
 }
 
 static int __init parse_numa_properties(void)
diff -Naur 2.5.69-bk-5-8-2003-numa/include/asm-ppc64/mmzone.h
2.5.69-bk-5-8-2003-numa-nrcpusnode/include/asm-ppc64/mmzone.h
--- 2.5.69-bk-5-8-2003-numa/include/asm-ppc64/mmzone.h 2003-04-24
14:17:14.000000000 -0700
+++ 2.5.69-bk-5-8-2003-numa-nrcpusnode/include/asm-ppc64/mmzone.h 2003-05-14
18:07:35.000000000 -0700
@@ -21,6 +21,7 @@
 extern int numa_cpu_lookup_table[];
 extern int numa_memory_lookup_table[];
 extern unsigned long numa_cpumask_lookup_table[];
+extern int nr_cpus_in_node[];
 
 #define MAX_MEMORY (1UL << 41)
 /* 256MB regions */
diff -Naur 2.5.69-bk-5-8-2003-numa/include/asm-ppc64/topology.h
2.5.69-bk-5-8-2003-numa-nrcpusnode/include/asm-ppc64/topology.h
--- 2.5.69-bk-5-8-2003-numa/include/asm-ppc64/topology.h 2003-05-14
11:03:10.000000000 -0700
+++ 2.5.69-bk-5-8-2003-numa-nrcpusnode/include/asm-ppc64/topology.h 2003-05-14
18:08:38.000000000 -0700
@@ -6,6 +6,11 @@
 
 #ifdef CONFIG_NUMA
 
+static inline int nr_cpus_node(int node)
+{
+ return nr_cpus_in_node[node];
+}
+
 static inline int cpu_to_node(int cpu)
 {
         int node;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu May 15 2003 - 22:00:54 EST