From: Xie Yuanbin <qq570070308@gmail.com>
To: dave.hansen@intel.com, peterz@infradead.org, tglx@kernel.org,
riel@surriel.com, segher@kernel.crashing.org, david@kernel.org,
hpa@zytor.com, arnd@arndb.de, anna-maria@linutronix.de,
mingo@redhat.com, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
vschneid@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
luto@kernel.org, houwenlong.hwl@antgroup.com,
frederic@kernel.org, akpm@linux-foundation.org,
lorenzo.stoakes@oracle.com, bhe@redhat.com, ryan.roberts@arm.com,
urezki@gmail.com, nysal@linux.ibm.com, max.kellermann@ionos.com
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
Xie Yuanbin <qq570070308@gmail.com>
Subject: Re: [PATCH v6 RESEND 1/3] x86/mm/tlb: Make enter_lazy_tlb() always inline on x86
Date: Tue, 10 Feb 2026 23:32:02 +0800 [thread overview]
Message-ID: <20260210153202.524-1-qq570070308@gmail.com> (raw)
In-Reply-To: <2e8bf3e4-162d-4245-b438-8f8896a48960@intel.com>
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)
| ^~~~~~~~~~~~
```
next prev parent reply other threads:[~2026-02-10 15:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-09 16:23 [PATCH v6 RESEND 1/3] x86/mm/tlb: Make enter_lazy_tlb() always inline on x86 Xie Yuanbin
2026-02-09 16:23 ` [PATCH v6 RESEND 2/3] sched: Make raw_spin_rq_unlock() inline Xie Yuanbin
2026-02-09 16:23 ` [PATCH v6 RESEND 3/3] sched/core: Make finish_task_switch() and its subfunctions always inline Xie Yuanbin
2026-02-09 19:24 ` [PATCH v6 RESEND 1/3] x86/mm/tlb: Make enter_lazy_tlb() always inline on x86 Dave Hansen
2026-02-10 15:32 ` Xie Yuanbin [this message]
2026-02-10 16:07 ` Dave Hansen
2026-02-11 15:36 ` Xie Yuanbin
2026-02-11 18:01 ` Dave Hansen
2026-02-12 15:19 ` Xie Yuanbin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260210153202.524-1-qq570070308@gmail.com \
--to=qq570070308@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=anna-maria@linutronix.de \
--cc=arnd@arndb.de \
--cc=bhe@redhat.com \
--cc=bp@alien8.de \
--cc=bsegall@google.com \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=david@kernel.org \
--cc=dietmar.eggemann@arm.com \
--cc=frederic@kernel.org \
--cc=houwenlong.hwl@antgroup.com \
--cc=hpa@zytor.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=luto@kernel.org \
--cc=max.kellermann@ionos.com \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=nysal@linux.ibm.com \
--cc=peterz@infradead.org \
--cc=riel@surriel.com \
--cc=rostedt@goodmis.org \
--cc=ryan.roberts@arm.com \
--cc=segher@kernel.crashing.org \
--cc=tglx@kernel.org \
--cc=urezki@gmail.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox