Skip to content

mm/vdpa: correct misuse of non-direct-reclaim __GFP_NOFAIL and improve related doc and warn

Barry Song linux-mm virtualization 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest3 patches 13 repliesIn review 2 of 3 applied
  2. v34 patches 96 repliesSuperseded
  3. v24 patches 23 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v15 patches41 repliesSuperseded

Patches in v4 2 of 3 applied

#Subject and filesSizeRepliesApplied
1/3vduse: avoid using __GFP_NOFAILdrivers/vdpa/vdpa_user/iova_domain.c drivers/vdpa/vdpa_user/iova_domain.h+12 -84 repliesApplied
2/3mm: document __GFP_NOFAIL must be blockableinclude/linux/gfp_types.h+4 -11 replyApplied
3/3mm: warn about illegal __GFP_NOFAIL usage in a more appropriate location and mannermm/page_alloc.c+25 -258 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchXie YongjiMichal HockoChristoph HellwigVlastimil BabkaDavidlohr BuesoDavid Hildenbrand
1/3R-b T-b
2/3A-b R-b A-b A-b A-b
3/3A-b R-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 6 reviewers.

Read the v4 thread

Cover letter [PATCH v4 0/3] mm/vdpa: correct misuse of non-direct-reclaim __GFP_NOFAIL and improve related doc and warn

From: Barry Song <[email protected]>

-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/[email protected]/
* 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/[email protected]/

-v2:
https://lore.kernel.org/linux-mm/[email protected]/

* 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/[email protected]/

__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/[email protected]/

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(-)
Signature · 1 line
2.34.1