Reclaim on PF_MEMALLOC and PF_MEMDIE Call into reclaim if we are in PF_MEMALLOC or PF_MEMDIE and interrupts are not disabled. In that case we can wait but should not do any allocations. Signed-off-by: Christoph Lameter --- mm/page_alloc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) Index: linux-2.6/mm/page_alloc.c =================================================================== --- linux-2.6.orig/mm/page_alloc.c 2007-08-13 22:48:31.000000000 -0700 +++ linux-2.6/mm/page_alloc.c 2007-08-13 23:08:16.000000000 -0700 @@ -1306,6 +1306,17 @@ nofail_alloc: zonelist, ALLOC_NO_WATERMARKS); if (page) goto got_pg; + /* + * If we are already in reclaim then things are + * already setup. We can simply call + * try_to_get_free_pages(). Just make sure that + * we do not allocate anything. + */ + if (p->flags & PF_MEMALLOC && + try_to_free_pages(zonelist->zones, order, + gfp_mask | ~__GFP_WAIT)) + goto restart; + if (gfp_mask & __GFP_NOFAIL) { congestion_wait(WRITE, HZ/50); goto nofail_alloc;