diff options
author | Kirill Korotaev <dev@sw.ru> | 2005-11-13 19:06:41 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-13 21:14:12 -0500 |
commit | 885036d32f5d3c427c3e2b385b5a5503805e3e52 (patch) | |
tree | 7f442b309a749d8cbe0f2ac5c38531eeff8bfcd8 /mm | |
parent | d4d28dd4b12649d02a89d19e6bd12ab92a6fcd4e (diff) |
[PATCH] mm: __GFP_NOFAIL fix
In __alloc_pages():
if ((p->flags & (PF_MEMALLOC | PF_MEMDIE)) && !in_interrupt()) {
/* go through the zonelist yet again, ignoring mins */
for (i = 0; zones[i] != NULL; i++) {
struct zone *z = zones[i];
page = buffered_rmqueue(z, order, gfp_mask);
if (page) {
zone_statistics(zonelist, z);
goto got_pg;
}
}
goto nopage; <<<< HERE!!! FAIL...
}
kswapd (which has PF_MEMALLOC flag) can fail to allocate memory even when
it allocates it with __GFP_NOFAIL flag.
Signed-Off-By: Pavel Emelianov <xemul@sw.ru>
Signed-Off-By: Denis Lunev <den@sw.ru>
Signed-Off-By: Kirill Korotaev <dev@sw.ru>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
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 | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 987225bdd66..b37dc0f78d0 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -895,6 +895,7 @@ zone_reclaim_retry: | |||
895 | if (((p->flags & PF_MEMALLOC) || unlikely(test_thread_flag(TIF_MEMDIE))) | 895 | if (((p->flags & PF_MEMALLOC) || unlikely(test_thread_flag(TIF_MEMDIE))) |
896 | && !in_interrupt()) { | 896 | && !in_interrupt()) { |
897 | if (!(gfp_mask & __GFP_NOMEMALLOC)) { | 897 | if (!(gfp_mask & __GFP_NOMEMALLOC)) { |
898 | nofail_alloc: | ||
898 | /* go through the zonelist yet again, ignoring mins */ | 899 | /* go through the zonelist yet again, ignoring mins */ |
899 | for (i = 0; (z = zones[i]) != NULL; i++) { | 900 | for (i = 0; (z = zones[i]) != NULL; i++) { |
900 | if (!cpuset_zone_allowed(z, gfp_mask)) | 901 | if (!cpuset_zone_allowed(z, gfp_mask)) |
@@ -903,6 +904,10 @@ zone_reclaim_retry: | |||
903 | if (page) | 904 | if (page) |
904 | goto got_pg; | 905 | goto got_pg; |
905 | } | 906 | } |
907 | if (gfp_mask & __GFP_NOFAIL) { | ||
908 | blk_congestion_wait(WRITE, HZ/50); | ||
909 | goto nofail_alloc; | ||
910 | } | ||
906 | } | 911 | } |
907 | goto nopage; | 912 | goto nopage; |
908 | } | 913 | } |