Re: [RESEND PATCH v2 0/8] mm: use spinlock guards for zone lock

From: Michal Hocko

Date: Wed Apr 08 2026 - 12:47:18 EST


On Wed 08-04-26 13:33:15, Dmitry Ilvokhin wrote:
> Resending v2 to get feedback from folks who work with this code, as
> Andrew suggested.
>
> 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.
>
> Based on mm-stable.
>
> Suggested-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
>
> 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]. Note: the fix is not yet in mm-stable, so
> it needs to be applied first to reproduce these results. With that
> fix, bloat-o-meter on x86 defconfig shows a net decrease of 49 bytes
> (-0.12%) for page_alloc.o.
> - 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: https://lore.kernel.org/all/cover.1774627568.git.d@xxxxxxxxxxxx/
> v1: https://lore.kernel.org/all/cover.1772811429.git.d@xxxxxxxxxxxx/
>
> [1]: https://lore.kernel.org/all/20260309164516.GE606826@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/
>
> 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(-)

I like the resulting code. For the whole series.
Acked-by: Michal Hocko <mhocko@xxxxxxxx>

--
Michal Hocko
SUSE Labs