]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Replace 'numnodes' with 'node_online_map' - x86_64
authorMatthew Dobson <colpatch@us.ibm.com>
Sat, 8 Jan 2005 05:57:12 +0000 (21:57 -0800)
committerLinus Torvalds <torvalds@evo.osdl.org>
Sat, 8 Jan 2005 05:57:12 +0000 (21:57 -0800)
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/x86_64/kernel/setup64.c
arch/x86_64/mm/k8topology.c
arch/x86_64/mm/numa.c
arch/x86_64/mm/srat.c
include/asm-x86_64/numa.h

index d0abfe9ae5658c7e2d6fba87cc88b507b43dae3e..d07c439cafe4e076c4371a41cc2cd91186658616 100644 (file)
@@ -82,7 +82,8 @@ void __init setup_per_cpu_areas(void)
                unsigned char *ptr;
 
                if (!NODE_DATA(cpu_to_node(i))) {
-                       printk("cpu with no node %d, numnodes %d\n", i, numnodes);
+                       printk("cpu with no node %d, num_online_nodes %d\n",
+                              i, num_online_nodes());
                        ptr = alloc_bootmem(size);
                } else { 
                        ptr = alloc_bootmem_node(NODE_DATA(cpu_to_node(i)), size);
index 7869b4c5c75dd9b6913e391b699fbd8a60df4847..b3acd04b3b30ed7d3ad81e76908a090dc0b50dae 100644 (file)
@@ -55,9 +55,10 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
        printk(KERN_INFO "Scanning NUMA topology in Northbridge %d\n", nb); 
 
        reg = read_pci_config(0, nb, 0, 0x60); 
-       numnodes =  ((reg >> 4) & 7) + 1; 
+       for (i = 0; i <= ((reg >> 4) & 7); i++)
+               node_set_online(i);
 
-       printk(KERN_INFO "Number of nodes %d (%x)\n", numnodes, reg);
+       printk(KERN_INFO "Number of nodes %d (%x)\n", num_online_nodes(), reg);
 
        memset(&nodes,0,sizeof(nodes)); 
        prevbase = 0;
@@ -69,11 +70,11 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
 
                nodeid = limit & 7; 
                if ((base & 3) == 0) { 
-                       if (i < numnodes) 
+                       if (i < num_online_nodes())
                                printk("Skipping disabled node %d\n", i); 
                        continue;
                } 
-               if (nodeid >= numnodes) { 
+               if (nodeid >= num_online_nodes()) {
                        printk("Ignoring excess node %d (%lx:%lx)\n", nodeid,
                               base, limit); 
                        continue;
index c7661956f79609c05f211817ef378bc1f797049a..b1a7db4f4d6dcc5ea1359643a161266f122fe4c4 100644 (file)
@@ -45,7 +45,7 @@ int __init compute_hash_shift(struct node *nodes)
        /* When in doubt use brute force. */
        while (shift < 48) { 
                memset(memnodemap,0xff,sizeof(*memnodemap) * NODEMAPSIZE); 
-               for (i = 0; i < numnodes; i++) { 
+               for_each_online_node(i) {
                        if (nodes[i].start == nodes[i].end) 
                                continue;
                        for (addr = nodes[i].start; 
@@ -111,8 +111,6 @@ void __init setup_node_bootmem(int nodeid, unsigned long start, unsigned long en
 
        reserve_bootmem_node(NODE_DATA(nodeid), nodedata_phys, pgdat_size); 
        reserve_bootmem_node(NODE_DATA(nodeid), bootmap_start, bootmap_pages<<PAGE_SHIFT);
-       if (nodeid + 1 > numnodes)
-               numnodes = nodeid + 1;
        node_set_online(nodeid);
 } 
 
@@ -197,15 +195,15 @@ static int numa_emulation(unsigned long start_pfn, unsigned long end_pfn)
                       i,
                       nodes[i].start, nodes[i].end,
                       (nodes[i].end - nodes[i].start) >> 20);
+               node_set_online(i);
        }
-       numnodes = numa_fake;
        memnode_shift = compute_hash_shift(nodes);
        if (memnode_shift < 0) {
                memnode_shift = 0;
                printk(KERN_ERR "No NUMA hash function found. Emulation disabled.\n");
                return -1;
        }
-       for (i = 0; i < numa_fake; i++)
+       for_each_online_node(i)
                setup_node_bootmem(i, nodes[i].start, nodes[i].end);
        numa_init_array();
        return 0;
@@ -240,7 +238,8 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
                /* setup dummy node covering all memory */ 
        memnode_shift = 63; 
        memnodemap[0] = 0;
-       numnodes = 1;
+       nodes_clear(node_online_map);
+       node_set_online(0);
        for (i = 0; i < NR_CPUS; i++)
                cpu_to_node[i] = 0;
        node_to_cpumask[0] = cpumask_of_cpu(0);
@@ -258,7 +257,7 @@ unsigned long __init numa_free_all_bootmem(void)
 { 
        int i;
        unsigned long pages = 0;
-       for_all_nodes(i) {
+       for_each_online_node(i) {
                pages += free_all_bootmem_node(NODE_DATA(i));
        }
        return pages;
@@ -267,7 +266,7 @@ unsigned long __init numa_free_all_bootmem(void)
 void __init paging_init(void)
 { 
        int i;
-       for_all_nodes(i) { 
+       for_each_online_node(i) {
                setup_node_zones(i); 
        }
 } 
index da7ee4812790aa45392f763c30f7f1284e5e5f01..1db7483a0564dcaa2209d67b8984e78db3832fa6 100644 (file)
@@ -27,10 +27,10 @@ static __u8  pxm2node[256] __initdata = { [0 ... 255] = 0xff };
 static __init int setup_node(int pxm)
 {
        if (pxm2node[pxm] == 0xff) {
-               if (numnodes > MAX_NUMNODES)
+               if (num_online_nodes() >= MAX_NUMNODES)
                        return -1;
-               pxm2node[pxm] = numnodes - 1;
-               numnodes++;
+               pxm2node[pxm] = num_online_nodes();
+               node_set_online(num_online_nodes());
        }
        return pxm2node[pxm];
 }
@@ -38,7 +38,7 @@ static __init int setup_node(int pxm)
 static __init int conflicting_nodes(unsigned long start, unsigned long end)
 {
        int i;
-       for (i = 0; i < numnodes; i++) {
+       for_each_online_node(i) {
                struct node *nd = &nodes[i];
                if (nd->start == nd->end)
                        continue;
@@ -155,10 +155,7 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
               nd->start, nd->end);
 }
 
-void __init acpi_numa_arch_fixup(void)
-{
-       numnodes--;
-}
+void __init acpi_numa_arch_fixup(void) {}
 
 /* Use the information discovered above to actually set up the nodes. */
 int __init acpi_scan_nodes(unsigned long start, unsigned long end)
index f102bbbc41ab4aa15788f4584f948b643a8ca62c..21843b35ef1819967946d6e17a4dd79d3021f9e7 100644 (file)
@@ -8,9 +8,6 @@ struct node {
        u64 start,end; 
 };
 
-#define for_all_nodes(x) for ((x) = 0; (x) < numnodes; (x)++) \
-                               if (node_online(x))
-
 extern int compute_hash_shift(struct node *nodes);
 
 #define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT))