]> Git Repo - linux.git/commit
page allocator: calculate the alloc_flags for allocation only once
authorPeter Zijlstra <[email protected]>
Tue, 16 Jun 2009 22:32:02 +0000 (15:32 -0700)
committerLinus Torvalds <[email protected]>
Wed, 17 Jun 2009 02:47:33 +0000 (19:47 -0700)
commit341ce06f69abfafa31b9468410a13dbd60e2b237
treed7702157c9addb8e67e6dce883650e20b3ddcbfd
parent3dd2826698b6902aafd9441ce28ebb44735fd0d6
page allocator: calculate the alloc_flags for allocation only once

Factor out the mapping between GFP and alloc_flags only once.  Once
factored out, it only needs to be calculated once but some care must be
taken.

[[email protected] says]
As the test:

-       if (((p->flags & PF_MEMALLOC) || unlikely(test_thread_flag(TIF_MEMDIE)))
-                       && !in_interrupt()) {
-               if (!(gfp_mask & __GFP_NOMEMALLOC)) {

has been replaced with a slightly weaker one:

+       if (alloc_flags & ALLOC_NO_WATERMARKS) {

Without care, this would allow recursion into the allocator via direct
reclaim.  This patch ensures we do not recurse when PF_MEMALLOC is set but
TF_MEMDIE callers are now allowed to directly reclaim where they would
have been prevented in the past.

Signed-off-by: Peter Zijlstra <[email protected]>
Acked-by: Pekka Enberg <[email protected]>
Signed-off-by: Mel Gorman <[email protected]>
Cc: Neil Brown <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: KOSAKI Motohiro <[email protected]>
Cc: Nick Piggin <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Lee Schermerhorn <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/page_alloc.c
This page took 0.058269 seconds and 4 git commands to generate.