Commit 5bdcf4f8 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Clean up MAX_NR_NODES/NUMNODES/etc. [2/5]

From: Matthew Dobson <colpatch@us.ibm.com>

Remove MAX_NR_NODES.  This value is only used in a couple of places, and
it's incorrectly used in all those places as far as I can tell.  Replace
with MAX_NUMNODES.  Create MAX_NODES_SHIFT and use this value to check
NODES_SHIFT is appropriate.  A possible future patch should make
MAX_NODES_SHIFT vary based on 32 vs.  64 bit archs.
parent c72da22f
...@@ -499,8 +499,8 @@ static struct task_struct * __init fork_by_hand(void) ...@@ -499,8 +499,8 @@ static struct task_struct * __init fork_by_hand(void)
#ifdef CONFIG_NUMA #ifdef CONFIG_NUMA
/* which logical CPUs are on which nodes */ /* which logical CPUs are on which nodes */
cpumask_t node_2_cpu_mask[MAX_NR_NODES] = cpumask_t node_2_cpu_mask[MAX_NUMNODES] =
{ [0 ... MAX_NR_NODES-1] = CPU_MASK_NONE }; { [0 ... MAX_NUMNODES-1] = CPU_MASK_NONE };
/* which node each logical CPU is on */ /* which node each logical CPU is on */
int cpu_2_node[NR_CPUS] = { [0 ... NR_CPUS-1] = 0 }; int cpu_2_node[NR_CPUS] = { [0 ... NR_CPUS-1] = 0 };
...@@ -518,7 +518,7 @@ static inline void unmap_cpu_to_node(int cpu) ...@@ -518,7 +518,7 @@ static inline void unmap_cpu_to_node(int cpu)
int node; int node;
printk("Unmapping cpu %d from all nodes\n", cpu); printk("Unmapping cpu %d from all nodes\n", cpu);
for (node = 0; node < MAX_NR_NODES; node ++) for (node = 0; node < MAX_NUMNODES; node ++)
cpu_clear(cpu, node_2_cpu_mask[node]); cpu_clear(cpu, node_2_cpu_mask[node]);
cpu_2_node[cpu] = -1; cpu_2_node[cpu] = -1;
} }
......
...@@ -304,19 +304,27 @@ extern void setup_per_zone_pages_min(void); ...@@ -304,19 +304,27 @@ extern void setup_per_zone_pages_min(void);
#define numa_node_id() (cpu_to_node(smp_processor_id())) #define numa_node_id() (cpu_to_node(smp_processor_id()))
#ifndef CONFIG_DISCONTIGMEM #ifndef CONFIG_DISCONTIGMEM
extern struct pglist_data contig_page_data; extern struct pglist_data contig_page_data;
#define NODE_DATA(nid) (&contig_page_data) #define NODE_DATA(nid) (&contig_page_data)
#define NODE_MEM_MAP(nid) mem_map #define NODE_MEM_MAP(nid) mem_map
#define MAX_NR_NODES 1 #define MAX_NODES_SHIFT 0
#else /* CONFIG_DISCONTIGMEM */ #else /* CONFIG_DISCONTIGMEM */
#include <asm/mmzone.h> #include <asm/mmzone.h>
/*
/* page->zone is currently 8 bits ... */ * page->zone is currently 8 bits
#define MAX_NR_NODES (255 / MAX_NR_ZONES) * there are 3 zones (2 bits)
* this leaves 8-2=6 bits for nodes
*/
#define MAX_NODES_SHIFT 6
#endif /* !CONFIG_DISCONTIGMEM */ #endif /* !CONFIG_DISCONTIGMEM */
#if NODES_SHIFT > MAX_NODES_SHIFT
#error NODES_SHIFT > MAX_NODES_SHIFT
#endif
extern DECLARE_BITMAP(node_online_map, MAX_NUMNODES); extern DECLARE_BITMAP(node_online_map, MAX_NUMNODES);
extern DECLARE_BITMAP(memblk_online_map, MAX_NR_MEMBLKS); extern DECLARE_BITMAP(memblk_online_map, MAX_NR_MEMBLKS);
......
...@@ -50,7 +50,7 @@ EXPORT_SYMBOL(nr_swap_pages); ...@@ -50,7 +50,7 @@ EXPORT_SYMBOL(nr_swap_pages);
* Used by page_zone() to look up the address of the struct zone whose * Used by page_zone() to look up the address of the struct zone whose
* id is encoded in the upper bits of page->flags * id is encoded in the upper bits of page->flags
*/ */
struct zone *zone_table[MAX_NR_ZONES*MAX_NR_NODES]; struct zone *zone_table[MAX_NR_ZONES*MAX_NUMNODES];
EXPORT_SYMBOL(zone_table); EXPORT_SYMBOL(zone_table);
static char *zone_names[MAX_NR_ZONES] = { "DMA", "Normal", "HighMem" }; static char *zone_names[MAX_NR_ZONES] = { "DMA", "Normal", "HighMem" };
......
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