linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/3] mm/vdpa: correct misuse of non-direct-reclaim __GFP_NOFAIL and improve related doc and warn
@ 2024-08-30 20:28 Barry Song
  2024-08-30 20:28 ` [PATCH v4 1/3] vduse: avoid using __GFP_NOFAIL Barry Song
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Barry Song @ 2024-08-30 20:28 UTC (permalink / raw)
  To: akpm, linux-mm, virtualization
  Cc: david, 42.hyeyoo, cl, hailong.liu, hch, iamjoonsoo.kim, mhocko,
	penberg, rientjes, roman.gushchin, torvalds, urezki, v-songbaohua,
	vbabka, laoar.shao

From: Barry Song <v-songbaohua@oppo.com>


-v4:
 * drop all BUG_ON, Linus, David, Yafang;
 * warn in a better place, Vlastimil;
 * drop patch 3/4, the maximum supported size for __GFP_NOFAIL will be
   discussed separately, Michal;
 
-v3:
 https://lore.kernel.org/linux-mm/20240817062449.21164-1-21cnbao@gmail.com/
 * collect reviewed-by, acked-by etc. Michal, Christoph, Vlastimil, Davidlohr,
   thanks!
 * use Jason's patch[1] to fix vdpa and refine his changelog.
 * refine changelogs
[1] https://lore.kernel.org/all/20240808054320.10017-1-jasowang@redhat.com/

-v2:
 https://lore.kernel.org/linux-mm/20240731000155.109583-1-21cnbao@gmail.com/

 * adjust vpda fix according to Jason and Michal's feedback, I would
   expect Jason to test it, thanks!
 * split BUG_ON of unavoidable failure and the case GFP_ATOMIC |
   __GFP_NOFAIL into two patches according to Vlastimil and Michal.
 * collect Michal's acked-by for patch 2 - the doc;
 * remove the new GFP_NOFAIL from this series, that one would be a
   separate enhancement patchset later on.

-v1:
 https://lore.kernel.org/linux-mm/20240724085544.299090-1-21cnbao@gmail.com/

__GFP_NOFAIL carries the semantics of never failing, so its callers
do not check the return value:
  %__GFP_NOFAIL: The VM implementation _must_ retry infinitely: the caller
  cannot handle allocation failures. The allocation could block
  indefinitely but will never return with failure. Testing for
  failure is pointless.

However, __GFP_NOFAIL can sometimes fail if it exceeds size limits
or is used with GFP_ATOMIC/GFP_NOWAIT in a non-sleepable context.
This patchset handles illegal using __GFP_NOFAIL together with
GFP_ATOMIC lacking __GFP_DIRECT_RECLAIM(without this, we can't do
anything to reclaim memory to satisfy the nofail requirement) and
improve related document and warnings.

The proper size limits for __GFP_NOFAIL will be handled separately
after more discussions.

* The discussion started from this topic:
 [PATCH RFC] mm: warn potential return NULL for kmalloc_array and
             kvmalloc_array with __GFP_NOFAIL

 https://lore.kernel.org/linux-mm/20240717230025.77361-1-21cnbao@gmail.com/


Barry Song (2):
  mm: document __GFP_NOFAIL must be blockable
  mm: warn about illegal __GFP_NOFAIL usage in a more appropriate
    location and manner

Jason Wang (1):
  vduse: avoid using __GFP_NOFAIL

 drivers/vdpa/vdpa_user/iova_domain.c | 19 ++++++-----
 drivers/vdpa/vdpa_user/iova_domain.h |  1 +
 include/linux/gfp_types.h            |  5 ++-
 mm/page_alloc.c                      | 50 ++++++++++++++--------------
 4 files changed, 41 insertions(+), 34 deletions(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2024-09-04  7:22 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-30 20:28 [PATCH v4 0/3] mm/vdpa: correct misuse of non-direct-reclaim __GFP_NOFAIL and improve related doc and warn Barry Song
2024-08-30 20:28 ` [PATCH v4 1/3] vduse: avoid using __GFP_NOFAIL Barry Song
2024-09-02  7:33   ` David Hildenbrand
2024-09-02  7:58     ` Jason Wang
2024-09-02  8:30       ` David Hildenbrand
2024-09-03  0:35         ` Jason Wang
2024-08-30 20:28 ` [PATCH v4 2/3] mm: document __GFP_NOFAIL must be blockable Barry Song
2024-09-02  7:34   ` David Hildenbrand
2024-08-30 20:28 ` [PATCH v4 3/3] mm: warn about illegal __GFP_NOFAIL usage in a more appropriate location and manner Barry Song
2024-09-01 20:18   ` Vlastimil Babka
2024-09-02  3:23   ` Yafang Shao
2024-09-02  4:00     ` Barry Song
2024-09-02  5:47       ` Yafang Shao
2024-09-02  7:40   ` David Hildenbrand
2024-09-02  7:58   ` Michal Hocko
2024-09-03 22:39     ` Barry Song
2024-09-04  7:22       ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).