Re: [PATCH 1/8] mm: use zone lock guard in reserve_highatomic_pageblock()
From: Vlastimil Babka
Date: Fri Mar 06 2026 - 13:25:10 EST
On 3/6/26 19:00, Steven Rostedt wrote:
>
> [ Adding Peter ]
>
> On Fri, 6 Mar 2026 09:53:36 -0800
> Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
>> On Fri, 6 Mar 2026 16:05:35 +0000 Dmitry Ilvokhin <d@xxxxxxxxxxxx> wrote:
>>
>> > Use the newly introduced zone_lock_irqsave lock guard in
>> > reserve_highatomic_pageblock() to replace the explicit lock/unlock and
>> > goto out_unlock pattern with automatic scope-based cleanup.
>> >
>> > ...
>> >
>> > - zone_lock_irqsave(zone, flags);
>> > + guard(zone_lock_irqsave)(zone);
>>
>> guard() is cute, but this patch adds a little overhead - defconfig
>> page_alloc.o text increases by 32 bytes, presumably all in
>> reserve_highatomic_pageblock(). More instructions, larger cache
>> footprint.
I get this:
Function old new delta
get_page_from_freelist 6389 6452 +63
>> So we're adding a little overhead to every user's Linux machine for all
>> time. In return for which the developers get a little convenience and
>> maintainability.
>
> I think maintainability is of importance. Is there any measurable slowdown?
> Or are we only worried about the text size increase?
>
>>
>> Is it worth it?
>
> This is being done all over the kernel. Perhaps we should look at ways to
> make the generic infrastructure more performant?
Yeah I don't think the guard construct in this case should be doing anything
here that wouldn't allow the compiler to compile to the exactly same result
as before? Either there's some problem with the infra, or we're just victim
of compiler heuristics. In both cases imho worth looking into rather than
rejecting the construct.
> -- Steve