diff options
author | Christoph Lameter <clameter@sgi.com> | 2006-12-06 23:33:26 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-07 11:39:25 -0500 |
commit | 952f3b51beb592f3f1de15adcdef802fc086ea91 (patch) | |
tree | 45d9b240230494d3d985400f81f963b67db1e788 /mm | |
parent | 5bcd234d881d83ac0259c6d42d98f134e31c60a8 (diff) |
[PATCH] GFP_THISNODE must not trigger global reclaim
The intent of GFP_THISNODE is to make sure that an allocation occurs on a
particular node. If this is not possible then NULL needs to be returned so
that the caller can choose what to do next on its own (the slab allocator
depends on that).
However, GFP_THISNODE currently triggers reclaim before returning a failure
(GFP_THISNODE means GFP_NORETRY is set). If we have over allocated a node
then we will currently do some reclaim before returning NULL. The caller
may want memory from other nodes before reclaim should be triggered. (If
the caller wants reclaim then he can directly use __GFP_THISNODE instead).
There is no flag to avoid reclaim in the page allocator and adding yet
another GFP_xx flag would be difficult given that we are out of available
flags.
So just compare and see if all bits for GFP_THISNODE (__GFP_THISNODE,
__GFP_NORETRY and __GFP_NOWARN) are set. If so then we return NULL before
waking up kswapd.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/page_alloc.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 5d123b399713..dc8753bdd47e 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -1151,6 +1151,17 @@ restart: | |||
1151 | if (page) | 1151 | if (page) |
1152 | goto got_pg; | 1152 | goto got_pg; |
1153 | 1153 | ||
1154 | /* | ||
1155 | * GFP_THISNODE (meaning __GFP_THISNODE, __GFP_NORETRY and | ||
1156 | * __GFP_NOWARN set) should not cause reclaim since the subsystem | ||
1157 | * (f.e. slab) using GFP_THISNODE may choose to trigger reclaim | ||
1158 | * using a larger set of nodes after it has established that the | ||
1159 | * allowed per node queues are empty and that nodes are | ||
1160 | * over allocated. | ||
1161 | */ | ||
1162 | if (NUMA_BUILD && (gfp_mask & GFP_THISNODE) == GFP_THISNODE) | ||
1163 | goto nopage; | ||
1164 | |||
1154 | for (z = zonelist->zones; *z; z++) | 1165 | for (z = zonelist->zones; *z; z++) |
1155 | wakeup_kswapd(*z, order); | 1166 | wakeup_kswapd(*z, order); |
1156 | 1167 | ||