Thread (29 messages) 29 messages, 6 authors, 2021-10-22

Re: [PATCH 2/6] MM: improve documentation for __GFP_NOFAIL

From: Vlastimil Babka <hidden>
Date: 2021-10-05 12:27:50
Also in: linux-doc, linux-ext4, linux-fsdevel, linux-nfs, linux-xfs, lkml

On 10/5/21 13:09, Michal Hocko wrote:
On Tue 05-10-21 11:20:51, Vlastimil Babka wrote:
[...]
quoted
quoted
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -209,7 +209,11 @@ struct vm_area_struct;
  * used only when there is no reasonable failure policy) but it is
  * definitely preferable to use the flag rather than opencode endless
  * loop around allocator.
- * Using this flag for costly allocations is _highly_ discouraged.
+ * Use of this flag may lead to deadlocks if locks are held which would
+ * be needed for memory reclaim, write-back, or the timely exit of a
+ * process killed by the OOM-killer.  Dropping any locks not absolutely
+ * needed is advisable before requesting a %__GFP_NOFAIL allocate.
+ * Using this flag for costly allocations (order>1) is _highly_ discouraged.
We define costly as 3, not 1. But sure it's best to avoid even order>0 for
__GFP_NOFAIL. Advising order>1 seems arbitrary though?
This is not completely arbitrary. We have a warning for any higher order
allocation.
rmqueue:
	WARN_ON_ONCE((gfp_flags & __GFP_NOFAIL) && (order > 1));
Oh, I missed that.
I do agree that "Using this flag for higher order allocations is
_highly_ discouraged.
Well, with the warning in place this is effectively forbidden, not just
discouraged.
quoted
quoted
  */
 #define __GFP_IO	((__force gfp_t)___GFP_IO)
 #define __GFP_FS	((__force gfp_t)___GFP_FS)

  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help