diff options
author | Mel Gorman <mel@csn.ul.ie> | 2008-04-28 02:12:14 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-28 08:58:18 -0700 |
commit | 0e88460da6ab7bb6a7ef83675412ed5b6315d741 (patch) | |
tree | 1feb4de2362e4998a0deeab66af1efb9c7b8bb34 /include/linux/gfp.h | |
parent | dac1d27bc8d5ca636d3014ecfdf94407031d1970 (diff) | |
download | op-kernel-dev-0e88460da6ab7bb6a7ef83675412ed5b6315d741.zip op-kernel-dev-0e88460da6ab7bb6a7ef83675412ed5b6315d741.tar.gz |
mm: introduce node_zonelist() for accessing the zonelist for a GFP mask
Introduce a node_zonelist() helper function. It is used to lookup the
appropriate zonelist given a node and a GFP mask. The patch on its own is a
cleanup but it helps clarify parts of the two-zonelist-per-node patchset. If
necessary, it can be merged with the next patch in this set without problems.
Reviewed-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Christoph Lameter <clameter@sgi.com>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/gfp.h')
-rw-r--r-- | include/linux/gfp.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index c17ba49..e865d51 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -154,10 +154,15 @@ static inline enum zone_type gfp_zone(gfp_t flags) /* * We get the zone list from the current node and the gfp_mask. * This zone list contains a maximum of MAXNODES*MAX_NR_ZONES zones. + * There are many zonelists per node, two for each active zone. * * For the normal case of non-DISCONTIGMEM systems the NODE_DATA() gets * optimized to &contig_page_data at compile-time. */ +static inline struct zonelist *node_zonelist(int nid, gfp_t flags) +{ + return NODE_DATA(nid)->node_zonelists + gfp_zone(flags); +} #ifndef HAVE_ARCH_FREE_PAGE static inline void arch_free_page(struct page *page, int order) { } @@ -178,8 +183,7 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, if (nid < 0) nid = numa_node_id(); - return __alloc_pages(gfp_mask, order, - NODE_DATA(nid)->node_zonelists + gfp_zone(gfp_mask)); + return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask)); } #ifdef CONFIG_NUMA |