Commit d61614fa authored by Matthew Dobson's avatar Matthew Dobson Committed by Linus Torvalds

[PATCH] Replace 'numnodes' with 'node_online_map' - x86_64

Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a930c8c6
......@@ -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);
......
......@@ -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;
......
......@@ -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);
}
}
......
......@@ -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)
......
......@@ -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))
......
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