diff options
author | Nishanth Aravamudan <nacc@us.ibm.com> | 2008-04-29 03:58:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-29 11:05:58 -0400 |
commit | ab857d09386661145924c9403792234aeca4bdff (patch) | |
tree | 02027a87f919d721615664910b415f21bd88e9c5 | |
parent | 86051ca5eaf5e560113ec7673462804c54284456 (diff) |
mm: fix misleading __GFP_REPEAT related comments
The definition and use of __GFP_REPEAT, __GFP_NOFAIL and __GFP_NORETRY in the
core VM have somewhat differing comments as to their actual semantics.
Annoyingly, the flags definition has inline and header comments, which might
be interpreted as not being equivalent. Just add references to the header
comments in the inline ones so they don't go out of sync in the future. In
their use in __alloc_pages() clarify that the current implementation treats
low-order allocations and __GFP_REPEAT allocations as distinct cases.
To clarify, the flags' semantics are:
__GFP_NORETRY means try no harder than one run through __alloc_pages
__GFP_REPEAT means __GFP_NOFAIL
__GFP_NOFAIL means repeat forever
order <= PAGE_ALLOC_COSTLY_ORDER means __GFP_NOFAIL
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Acked-by: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/gfp.h | 6 | ||||
-rw-r--r-- | mm/page_alloc.c | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index c37653b6843f..b414be387180 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
@@ -40,9 +40,9 @@ struct vm_area_struct; | |||
40 | #define __GFP_FS ((__force gfp_t)0x80u) /* Can call down to low-level FS? */ | 40 | #define __GFP_FS ((__force gfp_t)0x80u) /* Can call down to low-level FS? */ |
41 | #define __GFP_COLD ((__force gfp_t)0x100u) /* Cache-cold page required */ | 41 | #define __GFP_COLD ((__force gfp_t)0x100u) /* Cache-cold page required */ |
42 | #define __GFP_NOWARN ((__force gfp_t)0x200u) /* Suppress page allocation failure warning */ | 42 | #define __GFP_NOWARN ((__force gfp_t)0x200u) /* Suppress page allocation failure warning */ |
43 | #define __GFP_REPEAT ((__force gfp_t)0x400u) /* Retry the allocation. Might fail */ | 43 | #define __GFP_REPEAT ((__force gfp_t)0x400u) /* See above */ |
44 | #define __GFP_NOFAIL ((__force gfp_t)0x800u) /* Retry for ever. Cannot fail */ | 44 | #define __GFP_NOFAIL ((__force gfp_t)0x800u) /* See above */ |
45 | #define __GFP_NORETRY ((__force gfp_t)0x1000u)/* Do not retry. Might fail */ | 45 | #define __GFP_NORETRY ((__force gfp_t)0x1000u)/* See above */ |
46 | #define __GFP_COMP ((__force gfp_t)0x4000u)/* Add compound page metadata */ | 46 | #define __GFP_COMP ((__force gfp_t)0x4000u)/* Add compound page metadata */ |
47 | #define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */ | 47 | #define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */ |
48 | #define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */ | 48 | #define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */ |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 88eb59dd7ac6..6965be064a31 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -1611,8 +1611,9 @@ nofail_alloc: | |||
1611 | * Don't let big-order allocations loop unless the caller explicitly | 1611 | * Don't let big-order allocations loop unless the caller explicitly |
1612 | * requests that. Wait for some write requests to complete then retry. | 1612 | * requests that. Wait for some write requests to complete then retry. |
1613 | * | 1613 | * |
1614 | * In this implementation, __GFP_REPEAT means __GFP_NOFAIL for order | 1614 | * In this implementation, either order <= PAGE_ALLOC_COSTLY_ORDER or |
1615 | * <= 3, but that may not be true in other implementations. | 1615 | * __GFP_REPEAT mean __GFP_NOFAIL, but that may not be true in other |
1616 | * implementations. | ||
1616 | */ | 1617 | */ |
1617 | do_retry = 0; | 1618 | do_retry = 0; |
1618 | if (!(gfp_mask & __GFP_NORETRY)) { | 1619 | if (!(gfp_mask & __GFP_NORETRY)) { |