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 node state N_MEMORY. 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. N_MEMORY 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 | 1 + mm/page_alloc.c | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) Index: linux-2.6.23-rc1/include/linux/nodemask.h =================================================================== --- linux-2.6.23-rc1.orig/include/linux/nodemask.h 2007-07-23 16:53:00.000000000 -0700 +++ linux-2.6.23-rc1/include/linux/nodemask.h 2007-07-23 16:53:01.000000000 -0700 @@ -343,6 +343,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.23-rc1/mm/page_alloc.c =================================================================== --- linux-2.6.23-rc1.orig/mm/page_alloc.c 2007-07-23 16:53:00.000000000 -0700 +++ linux-2.6.23-rc1/mm/page_alloc.c 2007-07-23 16:53:01.000000000 -0700 @@ -2062,8 +2062,13 @@ static int __build_all_zonelists(void *d int nid; for_each_online_node(nid) { - build_zonelists(NODE_DATA(nid)); - build_zonelist_cache(NODE_DATA(nid)); + pg_data_t *pgdat = NODE_DATA(nid); + + build_zonelists(pgdat); + build_zonelist_cache(pgdat); + + if (pgdat->node_present_pages) + node_set_state(nid, N_MEMORY); } return 0; }