diff options
author | Matthew Dobson <colpatch@us.ibm.com> | 2004-10-18 17:58:00 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-10-18 17:58:00 -0700 |
commit | 593564660d9da4ebe34bb6352c68ddfca8d73fa1 (patch) | |
tree | a8c8e50e28f2f85a3723d573569e039b443cd291 /mm | |
parent | 66d5cab9f5225a0fe501305016129110d580d688 (diff) | |
download | history-593564660d9da4ebe34bb6352c68ddfca8d73fa1.tar.gz |
[PATCH] Create nodemask_t
The idea behind this patch is to create a nodemask_t as a node analog of
cpumask_t. As NUMA machines become more common, the need for a standard,
cross-platform bitmap of both online & possible nodes becomes more
apparent. We believe we've worked out most of the kinks of the variable
length bitmap types with the recent cpumask_t patches. Nodemasks are also
currently far less widespread than cpumasks. Further, inclusion at this
point in the kernel would mean consistency in node handling between 2.6 and
2.7.
Future goals would be to get rid of the 'numnodes' variable used to count
the number of online nodes, and replace with node_online_map. This would
allow arbitrary node numbering and facilitate node hotplugging.
(Nothing actually uses this yet, but several projects need it, and it does
model a well-defined physical grouping).
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/mempolicy.c | 10 | ||||
-rw-r--r-- | mm/page_alloc.c | 4 |
2 files changed, 9 insertions, 5 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 8fe9c7ee985334..9eac9c97110419 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -66,6 +66,7 @@ #include <linux/kernel.h> #include <linux/sched.h> #include <linux/mm.h> +#include <linux/nodemask.h> #include <linux/gfp.h> #include <linux/slab.h> #include <linux/string.h> @@ -95,7 +96,7 @@ static int nodes_online(unsigned long *nodes) { DECLARE_BITMAP(online2, MAX_NUMNODES); - bitmap_copy(online2, node_online_map, MAX_NUMNODES); + bitmap_copy(online2, nodes_addr(node_online_map), MAX_NUMNODES); if (bitmap_empty(online2, MAX_NUMNODES)) set_bit(0, online2); if (!bitmap_subset(nodes, online2, MAX_NUMNODES)) @@ -424,7 +425,7 @@ static void get_zonemask(struct mempolicy *p, unsigned long *nodes) case MPOL_PREFERRED: /* or use current node instead of online map? */ if (p->v.preferred_node < 0) - bitmap_copy(nodes, node_online_map, MAX_NUMNODES); + bitmap_copy(nodes, nodes_addr(node_online_map), MAX_NUMNODES); else __set_bit(p->v.preferred_node, nodes); break; @@ -692,7 +693,7 @@ static struct page *alloc_page_interleave(unsigned gfp, unsigned order, unsigned struct zonelist *zl; struct page *page; - BUG_ON(!test_bit(nid, node_online_map)); + BUG_ON(!node_online(nid)); zl = NODE_DATA(nid)->node_zonelists + (gfp & GFP_ZONEMASK); page = __alloc_pages(gfp, order, zl); if (page && page_zone(page) == zl->zones[0]) { @@ -1081,7 +1082,8 @@ void __init numa_policy_init(void) /* Set interleaving policy for system init. This way not all the data structures allocated at system boot end up in node zero. */ - if (sys_set_mempolicy(MPOL_INTERLEAVE, node_online_map, MAX_NUMNODES) < 0) + if (sys_set_mempolicy(MPOL_INTERLEAVE, nodes_addr(node_online_map), + MAX_NUMNODES) < 0) printk("numa_policy_init: interleaving failed\n"); } diff --git a/mm/page_alloc.c b/mm/page_alloc.c index f2b5f575a4105f..bd4e102ee22e30 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -31,10 +31,12 @@ #include <linux/topology.h> #include <linux/sysctl.h> #include <linux/cpu.h> +#include <linux/nodemask.h> #include <asm/tlbflush.h> -DECLARE_BITMAP(node_online_map, MAX_NUMNODES); +nodemask_t node_online_map = NODE_MASK_NONE; +nodemask_t node_possible_map = NODE_MASK_ALL; struct pglist_data *pgdat_list; unsigned long totalram_pages; unsigned long totalhigh_pages; |