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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Barry Song <v-songbaohua@xxxxxxxx>


-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@xxxxxxxxx/
 * 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@xxxxxxxxxx/

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

 * 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@xxxxxxxxx/

__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@xxxxxxxxx/


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





[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux