Re: [PATCH v6 10/12] x86/mm: Move flush_tlb_info back to the stack

From: Nadav Amit

Date: Thu Jun 04 2026 - 17:14:33 EST




> On 4 Jun 2026, at 23:54, Dave Hansen <dave.hansen@xxxxxxxxx> wrote:
>
> On 5/28/26 08:13, Chuyi Zhou wrote:
>> Commit 3db6d5a5ecaf ("x86/mm/tlb: Remove 'struct flush_tlb_info' from the
>> stack") converted flush_tlb_info from stack variable to per-CPU variable.
>> This brought about a performance improvement of around 3% in extreme test.
>
> You've basically (nicely) thrown down the gauntlet and told Nadav that
> his patch or methodology is bad. PeterZ also acked it Nadav's approach.

Dave, why can’t we all be friends. :)

I communicated with Zhou about this. Back when I made my original changes - the
ones Zhou is now editing — I also wanted to keep flush_tlb_info on the stack
with alignment. But PeterZ reverted that [1], because in certain cases (KASAN
with probably some experimental Intel larger cache-line size) the cache-line
alignment made the stack grow too much and triggered warnings.

That's what led us to move flush_tlb_info into a per-cpu struct (preemption
was disabled at that time, so there was no trade-off). Now that Zhou claims
that disabling the preemption is a pain-point, and therefore does not want
to set flush_tlb_info per-cpu, the solution we've landed on is to put it back
on the stack - avoiding the need for a single flush_tlb_info that depends on
preemption being disabled — while limiting the alignment to 64 bytes so the
stack doesn't grow out of control.

[1] https://lore.kernel.org/all/tip-780e0106d468a2962b16b52fdf42898f2639e0a0@xxxxxxxxxxxxxx/