Skip to content

mm: use spinlock guards for zone lock

Dmitry Ilvokhin linux-mm lkml 4 versions – Applied

Status from this message: [merged mm-stable] mm-use-zone-lock-guard-in-__offline_isolated_pages.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest8 patches 3 repliesApplied 8/8
  2. v2 posting 2/28 patches 3 repliesSuperseded
  3. v2 posting 1/28 patches 2 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v18 patches19 repliesApplied

Changes in v3 from the cover letter

- Rebased on top of mm-stable.
- Added Acked-by from Michal.

Patches in v3 All 8 applied

#Subject and filesSizeRepliesApplied
1/8mm: use zone lock guard in reserve_highatomic_pageblock()mm/page_alloc.c+5 -80 repliesApplied
2/8mm: use zone lock guard in unset_migratetype_isolate()mm/page_isolation.c+2 -51 replyApplied
3/8mm: use zone lock guard in unreserve_highatomic_pageblock()mm/page_alloc.c+2 -60 repliesApplied
4/8mm: use zone lock guard in set_migratetype_isolate()mm/page_isolation.c+26 -341 replyApplied
5/8mm: use zone lock guard in take_page_off_buddy()mm/page_alloc.c+3 -70 repliesApplied
6/8mm: use zone lock guard in put_page_back_buddy()mm/page_alloc.c+4 -80 repliesApplied
7/8mm: use zone lock guard in free_pcppages_bulk()mm/page_alloc.c+1 -40 repliesApplied
8/8mm: use zone lock guard in __offline_isolated_pages()mm/page_alloc.c+2 -30 repliesApplied

Reviews trailers per patch

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

PatchMichal HockoZi Yan
1/8A-b
2/8A-b A-b
3/8A-b
4/8A-b A-b
5/8A-b
6/8A-b
7/8A-b
8/8A-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 v3 0/8] mm: use spinlock guards for zone lock

This series uses spinlock guard for zone lock across several mm functions to replace explicit lock/unlock patterns with automatic scope-based cleanup.

This simplifies the control flow by removing 'flags' variables, goto labels, and redundant unlock calls.

Patches are ordered by decreasing value. The first six patches simplify the control flow by removing gotos, multiple unlock paths, or 'ret' variables. The last two are simpler lock/unlock pair conversions that only remove 'flags' and can be dropped if considered unnecessary churn.

Binary size increase is +39 bytes, with Peter Zijlstra's fix for guards
[1] applied (already in mm-stable). This is due to the compiler not being able to deduplicate epilogue and eliminate redundant NULL check. See discussion [2] for more details. I proposed a patch [3] that fixes this, but until it is merged we need to assume +39 bytes will stay (though it is compiler dependent).

Based on mm-stable.

v2 -> v3:
- Rebased on top of mm-stable.
- Added Acked-by from Michal.

v1 -> v2:

- Andrew Morton raised concerns about binary size increase in v1. Peter Zijlstra has since fixed the underlying issue in the guards infrastructure in tip [1].
- Rebased on mm-stable, since the patch this series depended on was dropped from mm-new.
- Converted guard(zone_lock_irqsave)(zone) to guard(spinlock_irqsave)(&zone->lock).
- Dropped redundant braces in unreserve_highatomic_pageblock() (Steven Rostedt)

v2 resend: https://lore.kernel.org/all/[email protected]/
v2: https://lore.kernel.org/all/[email protected]/
v1: https://lore.kernel.org/all/[email protected]/

[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://lore.kernel.org/all/[email protected]/
[3]: https://lore.kernel.org/all/[email protected]/

Dmitry Ilvokhin (8):
mm: use zone lock guard in reserve_highatomic_pageblock()
mm: use zone lock guard in unset_migratetype_isolate()
mm: use zone lock guard in unreserve_highatomic_pageblock()
mm: use zone lock guard in set_migratetype_isolate()
mm: use zone lock guard in take_page_off_buddy()
mm: use zone lock guard in put_page_back_buddy()
mm: use zone lock guard in free_pcppages_bulk()
mm: use zone lock guard in __offline_isolated_pages()

 mm/page_alloc.c     | 53 ++++++++++++-----------------------
 mm/page_isolation.c | 67 +++++++++++++++++++--------------------------
 2 files changed, 45 insertions(+), 75 deletions(-)
Signature · 1 line
2.52.0