[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260210153202.524-1-qq570070308@gmail.com>
Date: Tue, 10 Feb 2026 23:32:02 +0800
From: Xie Yuanbin <qq570070308@...il.com>
To: dave.hansen@...el.com,
peterz@...radead.org,
tglx@...nel.org,
riel@...riel.com,
segher@...nel.crashing.org,
david@...nel.org,
hpa@...or.com,
arnd@...db.de,
anna-maria@...utronix.de,
mingo@...hat.com,
juri.lelli@...hat.com,
vincent.guittot@...aro.org,
dietmar.eggemann@....com,
rostedt@...dmis.org,
bsegall@...gle.com,
mgorman@...e.de,
vschneid@...hat.com,
bp@...en8.de,
dave.hansen@...ux.intel.com,
luto@...nel.org,
houwenlong.hwl@...group.com,
frederic@...nel.org,
akpm@...ux-foundation.org,
lorenzo.stoakes@...cle.com,
bhe@...hat.com,
ryan.roberts@....com,
urezki@...il.com,
nysal@...ux.ibm.com,
max.kellermann@...os.com
Cc: linux-kernel@...r.kernel.org,
x86@...nel.org,
Xie Yuanbin <qq570070308@...il.com>
Subject: Re: [PATCH v6 RESEND 1/3] x86/mm/tlb: Make enter_lazy_tlb() always inline on x86
On Mon, 9 Feb 2026 11:24:06 -0800, Dave Hansen wrote:
> On 2/9/26 08:23, Xie Yuanbin wrote:
>> +/*
>> + * Please ignore the name of this function. It should be called
>> + * switch_to_kernel_thread().
>> + *
>> + * enter_lazy_tlb() is a hint from the scheduler that we are entering a
>> + * kernel thread or other context without an mm. Acceptable implementations
>> + * include doing nothing whatsoever, switching to init_mm, or various clever
>> + * lazy tricks to try to minimize TLB flushes.
>> + *
>> + * The scheduler reserves the right to call enter_lazy_tlb() several times
>> + * in a row. It will notify us that we're going back to a real mm by
>> + * calling switch_mm_irqs_off().
>> + */
>> +#ifndef MODULE
>
> What's with the #ifndef? Is this to avoid use spreading to modules and
> then making us export some other gunk? That seems like a generally good
> thing, but it's also totally random, different from the existing
> 'extern' declaration of enter_lazy_tlb(), and unique in the header.
This was just to fix a compilation error:
'cpu_tlbstate' is defined in 'include/asm/tlbflush.h' inside of
'#ifndef MODULE'. So if the '#ifndef MODULE' is not added here,
the compilation error will be triggered:
```log
arch/x86/include/asm/mmu_context.h: In function 'enter_lazy_tlb':
arch/x86/include/asm/mmu_context.h:155:27: error: 'cpu_tlbstate' undeclared (first use in this function); did you mean 'cpuhp_state'?
155 | if (this_cpu_read(cpu_tlbstate.loaded_mm) == &init_mm)
| ^~~~~~~~~~~~
```
Powered by blists - more mailing lists