Re: [PATCH v7 12/14] x86/mm: Move flush_tlb_info back to the stack

From: Chuyi Zhou

Date: Thu Jun 11 2026 - 22:23:29 EST


On 2026-06-12 12:20 a.m., Nadav Amit wrote:
>
>
> On 09/06/2026 12:17, Chuyi Zhou wrote:
>
>> -
>>   void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
>>                   unsigned long end, unsigned int stride_shift,
>>                   bool freed_tables)
>>   {
>> -    struct flush_tlb_info *info;
>> +    struct flush_tlb_info _info;
>> +    struct flush_tlb_info *info = &_info;
>>       int cpu = get_cpu();
>>       u64 new_tlb_gen;
>>       /* This is also a barrier that synchronizes with switch_mm(). */
>>       new_tlb_gen = inc_mm_tlb_gen(mm);
>> -    info = get_flush_tlb_info(mm, start, end, stride_shift,
>> freed_tables,
>> -                  new_tlb_gen);
>> +    init_flush_tlb_info(&_info, mm, start, end, stride_shift,
>> freed_tables,
>> +                new_tlb_gen);
>
> You use here &_info instead of info. At the same time
> kernel_tlb_flush_range() and friends use info for the struct itself, not
> the pointer, so maybe just get rid of _info and call it info?
>
>

Yes, that makes sense.

The extra pointer was kept to minimize the diff from the old
get_flush_tlb_info() usage, but after flush_tlb_info becomes
caller-local stack storage, naming the object "info" directly is clearer
and matches flush_tlb_kernel_range() and arch_tlbbatch_flush().