NUMA: Introduce node_memory_map It is necessary to know if nodes have memory since we have recently begun to add support for memoryless nodes. For that purpose we introduce a new bitmap called node_memory_map A node has its bit in node_memory_map set if it has memory. If a node has memory then it has at least one zone defined in its pgdat structure that is located in the pgdat itself. The node_memory_map can then be used in various places to insure that we do the right thing when we encounter a memoryless node. Signed-off-by: Lee Schermerhorn Signed-off-by: Nishanth Aravamudan Signed-off-by: Christoph Lameter --- include/linux/nodemask.h | 5 +++++ mm/page_alloc.c | 3 +++ 2 files changed, 8 insertions(+) Index: linux-2.6.22-rc4-mm2/include/linux/nodemask.h =================================================================== --- linux-2.6.22-rc4-mm2.orig/include/linux/nodemask.h 2007-06-23 14:23:01.000000000 -0700 +++ linux-2.6.22-rc4-mm2/include/linux/nodemask.h 2007-06-23 14:25:38.000000000 -0700 @@ -343,6 +347,7 @@ static inline void __nodes_remap(nodemas enum node_states { N_POSSIBLE, /* The node could become online at some point */ N_ONLINE, /* The node is online */ + N_MEMORY, /* The node has memory */ NR_NODE_STATES }; Index: linux-2.6.22-rc4-mm2/mm/page_alloc.c =================================================================== --- linux-2.6.22-rc4-mm2.orig/mm/page_alloc.c 2007-06-23 14:24:48.000000000 -0700 +++ linux-2.6.22-rc4-mm2/mm/page_alloc.c 2007-06-23 14:26:11.000000000 -0700 @@ -2316,6 +2316,9 @@ static void build_zonelists(pg_data_t *p } build_thisnode_zonelists(pgdat); + + if (pgdat->node_present_pages) + node_set_state(local_node, N_MEMORY); } /* Construct the zonelist performance cache - see further mmzone.h */