Skip to content

Discard __GFP_ATOMIC

Mel Gorman linux-mm lkml 3 versions – Applied

Status from this message: [merged mm-stable] mm-page_alloc-explicitly-define-how-__gfp_high-non-blocking-allocations-accesses-reserves.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest6 patches 3 repliesApplied 6/6
  2. v20 of 6 patches 0 repliesSuperseded
  3. v1 RFC6 patches 16 repliesSuperseded

Changes in v3 from the cover letter

o Non-blocking (GFP_NOWAIT) allocations get no reserve access (mhocko)
o __GFP_NOFAIL before OOM reserve access reduced (mhocko)
o Changelog clarifications (mhocko)
o Note that rt_task treatment to be deleted in changelog (mhocko)
o One ack dropped as the patch changed enough to invalidate it

Patches in v3 All 6 applied

#Subject and filesSizeRepliesApplied
1/6mm/page_alloc: Rename ALLOC_HIGH to ALLOC_MIN_RESERVEmm/internal.h mm/page_alloc.c+7 -50 repliesApplied
2/6mm/page_alloc: Treat RT tasks similar to __GFP_HIGHmm/page_alloc.c+1 -10 repliesApplied
3/6mm/page_alloc: Explicitly record high-order atomic allocations in alloc_flagsmm/internal.h mm/page_alloc.c+24 -61 replyApplied
4/6mm/page_alloc: Explicitly define what alloc flags deplete min reservesmm/internal.h mm/page_alloc.c+25 -120 repliesApplied
5/6mm/page_alloc: Explicitly define how __GFP_HIGH non-blocking allocations accesses reservesmm/internal.h mm/page_alloc.c+29 -222 repliesApplied
6/6mm: discard __GFP_ATOMICDocumentation/mm/balance.rst drivers/iommu/tegra-smmu.c include/linux/gfp_types.h +5 more+15 -280 repliesApplied

Reviews trailers per patch

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

PatchVlastimil BabkaMichal Hocko
1/6A-b A-b
2/6A-b A-b
3/6A-b A-b
4/6A-b A-b
5/6A-b A-b
6/6A-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH 0/6 v3] Discard __GFP_ATOMIC

This replaces the "Discard __GFP_ATOMIC v2" series in mm-unstable. There are changelog and patch replacements that make -fix patches impractical.

Changelog since v2
o Non-blocking (GFP_NOWAIT) allocations get no reserve access (mhocko)
o __GFP_NOFAIL before OOM reserve access reduced (mhocko)
o Changelog clarifications (mhocko)
o Note that rt_task treatment to be deleted in changelog (mhocko)
o One ack dropped as the patch changed enough to invalidate it

Changelog since v1
o Split one patch (vbabka)
o Improve OOM reserve handling (vbabka)
o Fix __GFP_RECLAIM vs __GFP_DIRECT_RECLAIM (vbabka)

Neil's patch has been residing in mm-unstable as commit 2fafb4fe8f7a ("mm: discard __GFP_ATOMIC") for a long time and recently brought up again. Most recently, I was worried that __GFP_HIGH allocations could use high-order atomic reserves which is unintentional but there was no response so lets revisit -- this series reworks how min reserves are used, protects highorder reserves and then finishes with Neil's patch with very minor modifications so it fits on top.

There was a review discussion on renaming __GFP_DIRECT_RECLAIM to __GFP_ALLOW_BLOCKING but I didn't think it was that big an issue and is ortogonal to the removal of __GFP_ATOMIC.

There were some concerns about how the gfp flags affect the min reserves but it never reached a solid conclusion so I made my own attempt.

The series tries to iron out some of the details on how reserves are used. ALLOC_HIGH becomes ALLOC_MIN_RESERVE and ALLOC_HARDER becomes ALLOC_NON_BLOCK and documents how the reserves are affected. For example, ALLOC_NON_BLOCK (no direct reclaim) on its own allows 25% of the min reserve. ALLOC_MIN_RESERVE (__GFP_HIGH) allows 50% and both combined allows deeper access again. ALLOC_OOM allows access to 75%.

High-order atomic allocations are explicitly handled with the caveat that no __GFP_ATOMIC flag means that any high-order allocation that specifies GFP_HIGH and cannot enter direct reclaim will be treated as if it was GFP_ATOMIC.

 Documentation/mm/balance.rst   |   2 +-
 drivers/iommu/tegra-smmu.c     |   4 +-
 include/linux/gfp_types.h      |  12 ++--
 include/trace/events/mmflags.h |   1 -
 lib/test_printf.c              |   8 +--
 mm/internal.h                  |  15 ++++-
 mm/page_alloc.c                | 106 ++++++++++++++++++++-------------
 tools/perf/builtin-kmem.c      |   1 -
 8 files changed, 88 insertions(+), 61 deletions(-)
Signature · 1 line
2.35.3