* [PATCH] x86/mm: Inline mm_mangle_tif_spec_bits() and l1d_flush_evaluate()
@ 2025-06-23 17:43 Khalid Ali
2025-06-23 17:55 ` Dave Hansen
0 siblings, 1 reply; 2+ messages in thread
From: Khalid Ali @ 2025-06-23 17:43 UTC (permalink / raw)
To: dave.hansen, luto, peterz, tglx, mingo, bp
Cc: x86, hpa, linux-kernel, Khalid Ali
From: Khalid Ali <khaliidcaliy@gmail.com>
These two functions are called from performance critical path like context
switch.
So make sure the compiler optimizes out by inlining. This won't result
increase of size because these functions only have one call site.
Signed-off-by: Khalid Ali <khaliidcaliy@gmail.com>
---
arch/x86/mm/tlb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 39f80111e6f1..657e8e254b69 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -624,7 +624,7 @@ static void l1d_flush_force_sigbus(struct callback_head *ch)
force_sig(SIGBUS);
}
-static void l1d_flush_evaluate(unsigned long prev_mm, unsigned long next_mm,
+static __always_inline void l1d_flush_evaluate(unsigned long prev_mm, unsigned long next_mm,
struct task_struct *next)
{
/* Flush L1D if the outgoing task requests it */
@@ -648,7 +648,7 @@ static void l1d_flush_evaluate(unsigned long prev_mm, unsigned long next_mm,
}
}
-static unsigned long mm_mangle_tif_spec_bits(struct task_struct *next)
+static __always_inline unsigned long mm_mangle_tif_spec_bits(struct task_struct *next)
{
unsigned long next_tif = read_task_thread_flags(next);
unsigned long spec_bits = (next_tif >> TIF_SPEC_IB) & LAST_USER_MM_SPEC_MASK;
--
2.49.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] x86/mm: Inline mm_mangle_tif_spec_bits() and l1d_flush_evaluate()
2025-06-23 17:43 [PATCH] x86/mm: Inline mm_mangle_tif_spec_bits() and l1d_flush_evaluate() Khalid Ali
@ 2025-06-23 17:55 ` Dave Hansen
0 siblings, 0 replies; 2+ messages in thread
From: Dave Hansen @ 2025-06-23 17:55 UTC (permalink / raw)
To: Khalid Ali, dave.hansen, luto, peterz, tglx, mingo, bp
Cc: x86, hpa, linux-kernel
On 6/23/25 10:43, Khalid Ali wrote:
> These two functions are called from performance critical path like context
> switch.
>
> So make sure the compiler optimizes out by inlining. This won't result
> increase of size because these functions only have one call site.
Khalid,
The compiler is currently given the latitude to choose an inlining
strategy for these functions. Generally, I'd assume that it's doing
something sane unless there's a specific compiler making suboptimal
decisions.
Do you have some evidence that compilers are doing the wrong thing?
Perhaps some generated code that looks wrong to you or some evidence
that the proposed change improves performance?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-23 17:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-23 17:43 [PATCH] x86/mm: Inline mm_mangle_tif_spec_bits() and l1d_flush_evaluate() Khalid Ali
2025-06-23 17:55 ` Dave Hansen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®