Skip to content

Commit 6477571

Browse files
Michal Hockotorvalds
authored andcommitted
mm: clarify __GFP_NOFAIL deprecation status
__GFP_NOFAIL is documented as a deprecated flag since commit 478352e ("mm: add comment about deprecation of __GFP_NOFAIL"). This has discouraged people from using it but in some cases an opencoded endless loop around allocator has been used instead. So the allocator is not aware of the de facto __GFP_NOFAIL allocation because this information was not communicated properly. Let's make clear that if the allocation context really cannot afford failure because there is no good failure policy then using __GFP_NOFAIL is preferable to opencoding the loop outside of the allocator. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Michal Hocko <mhocko@suse.cz> Acked-by: David Rientjes <rientjes@google.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Dave Chinner <david@fromorbit.com> Cc: "Theodore Ts'o" <tytso@mit.edu> Cc: Mel Gorman <mgorman@suse.de> Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Cc: "David S. Miller" <davem@davemloft.net> Cc: Vipul Pandya <vipul@chelsio.com> Cc: Jan Kara <jack@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent ac17382 commit 6477571

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

include/linux/gfp.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ struct vm_area_struct;
5757
* _might_ fail. This depends upon the particular VM implementation.
5858
*
5959
* __GFP_NOFAIL: The VM implementation _must_ retry infinitely: the caller
60-
* cannot handle allocation failures. This modifier is deprecated and no new
61-
* users should be added.
60+
* cannot handle allocation failures. New users should be evaluated carefully
61+
* (and the flag should be used only when there is no reasonable failure policy)
62+
* but it is definitely preferable to use the flag rather than opencode endless
63+
* loop around allocator.
6264
*
6365
* __GFP_NORETRY: The VM implementation must not retry indefinitely.
6466
*

0 commit comments

Comments
 (0)