cpusets: update mems allowed in page allocator
authorDavid Rientjes <rientjes@google.com>
Wed, 12 Nov 2008 21:25:37 +0000 (13:25 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 13 Nov 2008 01:17:16 +0000 (17:17 -0800)
If all allowable memory is unreclaimable, it is possible to loop forever
in the page allocator for ~__GFP_NORETRY allocations.

During this time, it is also possible for a task's cpuset to expand its
set of allowable nodes so that it now includes free memory.  The cached
copy of this set, current->mems_allowed, is stale, however, since there
has not been a subsequent call to cpuset_update_task_memory_state().

The cached copy of the set of allowable nodes is now updated in the page
allocator's slow path so the additional memory is available to
get_page_from_freelist().

[akpm@linux-foundation.org: add comment]
Signed-off-by: David Rientjes <rientjes@google.com>
Cc: Paul Menage <menage@google.com>
Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/page_alloc.c

index 54069e64e3a8a4b0c9a0450aba08b7f0fa21c5f9..d8ac01474563954fed58a1f87e2249c99827c430 100644 (file)
@@ -1561,6 +1561,10 @@ nofail_alloc:
 
        /* We now go into synchronous reclaim */
        cpuset_memory_pressure_bump();
+       /*
+        * The task's cpuset might have expanded its set of allowable nodes
+        */
+       cpuset_update_task_memory_state();
        p->flags |= PF_MEMALLOC;
        reclaim_state.reclaimed_slab = 0;
        p->reclaim_state = &reclaim_state;