[PATCH] [3/4] x86_64: Fix NUMA hash setup

From: Andi Kleen
Date: Wed Jan 12 2005 - 02:13:49 EST


Fix NUMA hash setup on x86-64

Signed-off-by: Andi Kleen <ak@xxxxxxx>

Index: linux/arch/x86_64/mm/k8topology.c
===================================================================
--- linux.orig/arch/x86_64/mm/k8topology.c 2005-01-12 06:49:42.%N +0100
+++ linux/arch/x86_64/mm/k8topology.c 2005-01-12 07:43:50.%N +0100
@@ -148,7 +148,7 @@
if (!found)
return -1;

- memnode_shift = compute_hash_shift(nodes);
+ memnode_shift = compute_hash_shift(nodes, numnodes);
if (memnode_shift < 0) {
printk(KERN_ERR "No NUMA node hash function found. Contact maintainer\n");
return -1;
Index: linux/arch/x86_64/mm/srat.c
===================================================================
--- linux.orig/arch/x86_64/mm/srat.c 2005-01-12 04:15:43.%N +0100
+++ linux/arch/x86_64/mm/srat.c 2005-01-12 07:44:23.%N +0100
@@ -166,7 +166,7 @@
int i;
if (acpi_numa <= 0)
return -1;
- memnode_shift = compute_hash_shift(nodes);
+ memnode_shift = compute_hash_shift(nodes, nodes_weight(nodes_parsed));
if (memnode_shift < 0) {
printk(KERN_ERR
"SRAT: No NUMA node hash function found. Contact maintainer\n");
Index: linux/include/asm-x86_64/numa.h
===================================================================
--- linux.orig/include/asm-x86_64/numa.h 2005-01-09 18:19:35.%N +0100
+++ linux/include/asm-x86_64/numa.h 2005-01-12 07:42:42.%N +0100
@@ -8,7 +8,7 @@
u64 start,end;
};

-extern int compute_hash_shift(struct node *nodes);
+extern int compute_hash_shift(struct node *nodes, int numnodes);

#define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT))

Index: linux/arch/x86_64/mm/numa.c
===================================================================
--- linux.orig/arch/x86_64/mm/numa.c 2005-01-12 06:47:00.%N +0100
+++ linux/arch/x86_64/mm/numa.c 2005-01-12 07:46:05.%N +0100
@@ -34,9 +34,7 @@

int numa_off __initdata;

-unsigned long nodes_present;
-
-int __init compute_hash_shift(struct node *nodes)
+int __init compute_hash_shift(struct node *nodes, int numnodes)
{
int i;
int shift = 24;
@@ -45,7 +43,7 @@
/* When in doubt use brute force. */
while (shift < 48) {
memset(memnodemap,0xff,sizeof(*memnodemap) * NODEMAPSIZE);
- for_each_online_node(i) {
+ for (i = 0; i < numnodes; i++) {
if (nodes[i].start == nodes[i].end)
continue;
for (addr = nodes[i].start;
@@ -188,7 +186,7 @@
(nodes[i].end - nodes[i].start) >> 20);
node_set_online(i);
}
- memnode_shift = compute_hash_shift(nodes);
+ memnode_shift = compute_hash_shift(nodes, numa_fake);
if (memnode_shift < 0) {
memnode_shift = 0;
printk(KERN_ERR "No NUMA hash function found. Emulation disabled.\n");
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/