mm: fix misleading __GFP_REPEAT related comments
Subsystems (3)
RFC PATCH 1/1 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
include/linux/gfp.h +3 -3
@@ -40,9 +40,9 @@ struct vm_area_struct;#define __GFP_FS ((__force gfp_t)0x80u)/* Can call down to low-level FS? */ #define __GFP_COLD ((__force gfp_t)0x100u)/* Cache-cold page required */ #define __GFP_NOWARN ((__force gfp_t)0x200u)/* Suppress page allocation failure warning */ -#define __GFP_REPEAT ((__force gfp_t)0x400u)/* Retry the allocation. Might fail */ -#define __GFP_NOFAIL ((__force gfp_t)0x800u)/* Retry for ever. Cannot fail */ -#define __GFP_NORETRY ((__force gfp_t)0x1000u)/* Do not retry. Might fail */ +#define __GFP_REPEAT ((__force gfp_t)0x400u)/* See above */ +#define __GFP_NOFAIL ((__force gfp_t)0x800u)/* See above */ +#define __GFP_NORETRY ((__force gfp_t)0x1000u)/* See above */ #define __GFP_COMP ((__force gfp_t)0x4000u)/* Add compound page metadata */ #define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */ #define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u)/* Don't use emergency reserves */
mm/page_alloc.c +3 -2
@@ -1608,8 +1608,9 @@ nofail_alloc:* Don't let big-order allocations loop unless the caller explicitly * requests that. Wait for some write requests to complete then retry. * -* In this implementation, __GFP_REPEAT means __GFP_NOFAIL for order -* <= 3, but that may not be true in other implementations. +* In this implementation, either order <= PAGE_ALLOC_COSTLY_ORDER or +* __GFP_REPEAT mean __GFP_NOFAIL, but that may not be true in other +* implementations. */ do_retry =0 ;if (!(gfp_mask & __GFP_NORETRY)) {
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · Nishanth Aravamudan
To clarify, the flags' semantics are:
__GFP_NORETRYmeans try no harder than one run through__alloc_pages
__GFP_REPEATmeans__GFP_NOFAIL
The __GFP_REPEAT == __GFP_NOFAIL?
If so then remove __GFP_REPEAT.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 11 lines · Christoph Lameter
Quoted 5 lines · Nishanth Aravamudan
To clarify, the flags' semantics are:
__GFP_NORETRYmeans try no harder than one run through__alloc_pages
__GFP_REPEATmeans__GFP_NOFAILThe
__GFP_REPEAT==__GFP_NOFAIL?If so then remove
__GFP_REPEAT.
I'm purely documenting the state of things in this patch. In a follow-on set of patches, I try to change the semantics of __GFP_REPEAT for large-order allocations.
Also, note, this is only in "this implementation" as mentioned all over page_alloc.c.
Thanks,
Nish
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 3 lines · Nishanth Aravamudan
I'm purely documenting the state of things in this patch. In a follow-on set of patches, I try to change the semantics of
__GFP_REPEATfor large-order allocations.
Ahh. Good.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>