[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87345beoq2.ffs@tglx>
Date: Mon, 15 Dec 2025 16:42:13 +0100
From: Thomas Gleixner <tglx@...utronix.de>
To: Xie Yuanbin <qq570070308@...il.com>, peterz@...radead.org,
riel@...riel.com, segher@...nel.crashing.org, david@...nel.org,
hpa@...or.com, arnd@...db.de, acme@...nel.org, adrian.hunter@...el.com,
agordeev@...ux.ibm.com, akpm@...ux-foundation.org, alex@...ti.fr,
alexander.shishkin@...ux.intel.com, andreas@...sler.com,
anshuman.khandual@....com, aou@...s.berkeley.edu,
borntraeger@...ux.ibm.com, bp@...en8.de, bsegall@...gle.com,
dave.hansen@...ux.intel.com, davem@...emloft.net,
dietmar.eggemann@....com, frederic@...nel.org, gor@...ux.ibm.com,
hca@...ux.ibm.com, irogers@...gle.com, james.clark@...aro.org,
jolsa@...nel.org, juri.lelli@...hat.com, justinstitt@...gle.com,
lorenzo.stoakes@...cle.com, luto@...nel.org, mark.rutland@....com,
mathieu.desnoyers@...icios.com, max.kellermann@...os.com, mgorman@...e.de,
mingo@...hat.com, morbo@...gle.com, namhyung@...nel.org,
nathan@...nel.org, nick.desaulniers+lkml@...il.com, nysal@...ux.ibm.com,
palmer@...belt.com, paulmck@...nel.org, pjw@...nel.org,
rostedt@...dmis.org, ryan.roberts@....com, svens@...ux.ibm.com,
thuth@...hat.com, urezki@...il.com, vincent.guittot@...aro.org,
vschneid@...hat.com, linux@...linux.org.uk
Cc: linux-kernel@...r.kernel.org, x86@...nel.org,
linux-arm-kernel@...ts.infradead.org, linux-riscv@...ts.infradead.org,
linux-s390@...r.kernel.org, sparclinux@...r.kernel.org,
linux-perf-users@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH v5 1/3] x86/mm/tlb: Make enter_lazy_tlb() always inline
on x86
On Mon, Dec 15 2025 at 03:09, Xie Yuanbin wrote:
> enter_lazy_tlb() on x86 is short enough, and is called in context
> switching, which is the hot code path.
>
> Make enter_lazy_tlb() always inline on x86 to optimize performance.
>
> Signed-off-by: Xie Yuanbin <qq570070308@...il.com>
> Reviewed-by: Rik van Riel <riel@...riel.com>
> Reported-by: kernel test robot <lkp@...el.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202511091959.kfmo9kPB-lkp@intel.com/
> Closes: https://lore.kernel.org/oe-kbuild-all/202511092219.73aMMES4-lkp@intel.com/
> Closes: https://lore.kernel.org/oe-kbuild-all/202511100042.ZklpqjOY-lkp@intel.com/
These Reported-by and Closes tags are just wrong. This is a new patch
and the robot reported failures against earlier versions. The robot
report is very clear about that:
"If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
Reported-by:...
Closes:..."
No?
> +/*
> + * Please ignore the name of this function. It should be called
> + * switch_to_kernel_thread().
And why is it not renamed then?
> + *
> + * enter_lazy_tlb() is a hint from the scheduler that we are entering a
We enter a kernel thread? AFAIK the metaverse has been canceled.
> + * 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
It will notify us by sending email or what?
> + * calling switch_mm_irqs_off().
> + */
> #define enter_lazy_tlb enter_lazy_tlb
> -extern void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk);
> +#ifndef MODULE
> +static __always_inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
> +{
> + if (this_cpu_read(cpu_tlbstate.loaded_mm) == &init_mm)
> + return;
> +
> + this_cpu_write(cpu_tlbstate_shared.is_lazy, true);
> +}
Please move the '#define enter_....' under the inline function. That's
way simpler to read.
Thanks,
tglx
Powered by blists - more mailing lists