aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/gfp.h
diff options
context:
space:
mode:
authorMel Gorman <mel@csn.ul.ie>2008-04-28 05:12:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-28 11:58:18 -0400
commit54a6eb5c4765aa573a030ceeba2c14e3d2ea5706 (patch)
tree547176a090beb787722a153cf2b8b942dc0e68db /include/linux/gfp.h
parent18ea7e710d2452fa726814a406779188028cf1bf (diff)
mm: use two zonelist that are filtered by GFP mask
Currently a node has two sets of zonelists, one for each zone type in the system and a second set for GFP_THISNODE allocations. Based on the zones allowed by a gfp mask, one of these zonelists is selected. All of these zonelists consume memory and occupy cache lines. This patch replaces the multiple zonelists per-node with two zonelists. The first contains all populated zones in the system, ordered by distance, for fallback allocations when the target/preferred node has no free pages. The second contains all populated zones in the node suitable for GFP_THISNODE allocations. An iterator macro is introduced called for_each_zone_zonelist() that interates through each zone allowed by the GFP flags in the selected zonelist. Signed-off-by: Mel Gorman <mel@csn.ul.ie> Acked-by: Christoph Lameter <clameter@sgi.com> 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.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index e865d51f1c74..e1c6064cb6c7 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -151,17 +151,26 @@ static inline enum zone_type gfp_zone(gfp_t flags)
151 * virtual kernel addresses to the allocated page(s). 151 * virtual kernel addresses to the allocated page(s).
152 */ 152 */
153 153
154static inline int gfp_zonelist(gfp_t flags)
155{
156 if (NUMA_BUILD && unlikely(flags & __GFP_THISNODE))
157 return 1;
158
159 return 0;
160}
161
154/* 162/*
155 * We get the zone list from the current node and the gfp_mask. 163 * 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. 164 * This zone list contains a maximum of MAXNODES*MAX_NR_ZONES zones.
157 * There are many zonelists per node, two for each active zone. 165 * There are two zonelists per node, one for all zones with memory and
166 * one containing just zones from the node the zonelist belongs to.
158 * 167 *
159 * For the normal case of non-DISCONTIGMEM systems the NODE_DATA() gets 168 * For the normal case of non-DISCONTIGMEM systems the NODE_DATA() gets
160 * optimized to &contig_page_data at compile-time. 169 * optimized to &contig_page_data at compile-time.
161 */ 170 */
162static inline struct zonelist *node_zonelist(int nid, gfp_t flags) 171static inline struct zonelist *node_zonelist(int nid, gfp_t flags)
163{ 172{
164 return NODE_DATA(nid)->node_zonelists + gfp_zone(flags); 173 return NODE_DATA(nid)->node_zonelists + gfp_zonelist(flags);
165} 174}
166 175
167#ifndef HAVE_ARCH_FREE_PAGE 176#ifndef HAVE_ARCH_FREE_PAGE