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

Andrew Morton
2026-04-29T15:37:31Z

On Wed, 29 Apr 2026 12:02:05 +0000 Dmitry Ilvokhin <d@ilvokhin.com> wrote:

> 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).

OK, thanks, I'll queue it up.

Yet again: the question here is whether those who work on this code
like guard(), or would prefer the traditional open-coded locking.
Michal was an ack, others were silent.