[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aPzgXBd34r2wVy8I@gate>
Date: Sat, 25 Oct 2025 09:36:12 -0500
From: Segher Boessenkool <segher@...nel.crashing.org>
To: Rik van Riel <riel@...riel.com>
Cc: Xie Yuanbin <qq570070308@...il.com>, linux@...linux.org.uk,
mathieu.desnoyers@...icios.com, paulmck@...nel.org, pjw@...nel.org,
palmer@...belt.com, aou@...s.berkeley.edu, alex@...ti.fr,
hca@...ux.ibm.com, gor@...ux.ibm.com, agordeev@...ux.ibm.com,
borntraeger@...ux.ibm.com, svens@...ux.ibm.com, davem@...emloft.net,
andreas@...sler.com, tglx@...utronix.de, mingo@...hat.com,
bp@...en8.de, dave.hansen@...ux.intel.com, hpa@...or.com,
luto@...nel.org, peterz@...radead.org, acme@...nel.org,
namhyung@...nel.org, mark.rutland@....com,
alexander.shishkin@...ux.intel.com, jolsa@...nel.org,
irogers@...gle.com, adrian.hunter@...el.com, anna-maria@...utronix.de,
frederic@...nel.org, juri.lelli@...hat.com, vincent.guittot@...aro.org,
dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
mgorman@...e.de, vschneid@...hat.com, thuth@...hat.com,
akpm@...ux-foundation.org, david@...hat.com,
lorenzo.stoakes@...cle.com, ryan.roberts@....com,
max.kellermann@...os.com, urezki@...il.com, nysal@...ux.ibm.com,
x86@...nel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, linux-riscv@...ts.infradead.org,
linux-s390@...r.kernel.org, sparclinux@...r.kernel.org,
linux-perf-users@...r.kernel.org, will@...nel.org
Subject: Re: [PATCH 2/3] Provide and use an always inline version of
finish_task_switch
On Fri, Oct 24, 2025 at 05:36:06PM -0400, Rik van Riel wrote:
> On Sat, 2025-10-25 at 02:35 +0800, Xie Yuanbin wrote:
> > finish_task_switch is called during context switching,
> > inlining it can bring some performance benefits.
> >
> > Add an always inline version `finish_task_switch_ainline` to be
> > called
> > during context switching, and keep the original version for being
> > called
> > elsewhere, so as to take into account the size impact.
>
> Does that actually work, or does the compiler
> still inline some of those "non-inlined" versions,
> anyway?
Of course the compiler does! That is part of the compiler's job after
all, to generate fast, efficient code!
The compiler will inline stuff when a) it *can*, mostly it has to have
the function body available; and b) it estimates it to be a win to
inline it. There is a whole bunch of heuristics for this. One of those
is that the always_inline attribute will do the utmost to get inlining
to happen.
(All that is assuming you have -finline-functions turned on, like you do
have at -O2).
Segher
Powered by blists - more mailing lists