diff options
author | Mel Gorman <mel@csn.ul.ie> | 2008-04-28 05:12:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-28 11:58:18 -0400 |
commit | 0e88460da6ab7bb6a7ef83675412ed5b6315d741 (patch) | |
tree | 1feb4de2362e4998a0deeab66af1efb9c7b8bb34 /include/linux | |
parent | dac1d27bc8d5ca636d3014ecfdf94407031d1970 (diff) |
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')
-rw-r--r-- | include/linux/gfp.h | 8 | ||||
-rw-r--r-- | include/linux/mempolicy.h | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index c17ba4945203..e865d51f1c74 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) | |||
154 | /* | 154 | /* |
155 | * We get the zone list from the current node and the gfp_mask. | 155 | * We get the zone list from the current node and the gfp_mask. |
156 | * This zone list contains a maximum of MAXNODES*MAX_NR_ZONES zones. | 156 | * This zone list contains a maximum of MAXNODES*MAX_NR_ZONES zones. |
157 | * There are many zonelists per node, two for each active zone. | ||
157 | * | 158 | * |
158 | * For the normal case of non-DISCONTIGMEM systems the NODE_DATA() gets | 159 | * For the normal case of non-DISCONTIGMEM systems the NODE_DATA() gets |
159 | * optimized to &contig_page_data at compile-time. | 160 | * optimized to &contig_page_data at compile-time. |
160 | */ | 161 | */ |
162 | static inline struct zonelist *node_zonelist(int nid, gfp_t flags) | ||
163 | { | ||
164 | return NODE_DATA(nid)->node_zonelists + gfp_zone(flags); | ||
165 | } | ||
161 | 166 | ||
162 | #ifndef HAVE_ARCH_FREE_PAGE | 167 | #ifndef HAVE_ARCH_FREE_PAGE |
163 | static inline void arch_free_page(struct page *page, int order) { } | 168 | 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, | |||
178 | if (nid < 0) | 183 | if (nid < 0) |
179 | nid = numa_node_id(); | 184 | nid = numa_node_id(); |
180 | 185 | ||
181 | return __alloc_pages(gfp_mask, order, | 186 | return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask)); |
182 | NODE_DATA(nid)->node_zonelists + gfp_zone(gfp_mask)); | ||
183 | } | 187 | } |
184 | 188 | ||
185 | #ifdef CONFIG_NUMA | 189 | #ifdef CONFIG_NUMA |
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index 59c4865bc85f..69160dc32d48 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h | |||
@@ -241,7 +241,7 @@ static inline void mpol_fix_fork_child_flag(struct task_struct *p) | |||
241 | static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma, | 241 | static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma, |
242 | unsigned long addr, gfp_t gfp_flags, struct mempolicy **mpol) | 242 | unsigned long addr, gfp_t gfp_flags, struct mempolicy **mpol) |
243 | { | 243 | { |
244 | return NODE_DATA(0)->node_zonelists + gfp_zone(gfp_flags); | 244 | return node_zonelist(0, gfp_flags); |
245 | } | 245 | } |
246 | 246 | ||
247 | static inline int do_migrate_pages(struct mm_struct *mm, | 247 | static inline int do_migrate_pages(struct mm_struct *mm, |