[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250503143856.GA9009@redhat.com>
Date: Sat, 3 May 2025 16:38:56 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Ingo Molnar <mingo@...nel.org>
Cc: linux-kernel@...r.kernel.org, Andy Lutomirski <luto@...capital.net>,
Dave Hansen <dave@...1.net>, Brian Gerst <brgerst@...il.com>,
Peter Zijlstra <peterz@...radead.org>,
Borislav Petkov <bp@...en8.de>, "H . Peter Anvin" <hpa@...or.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
"Chang S . Bae" <chang.seok.bae@...el.com>
Subject: [PATCH tip/x86/fpu 5/6] x86/fpu: fpu__drop: check TIF_NEED_FPU_LOAD
instead of PF_KTHREAD|PF_USER_WORKER
PF_KTHREAD|PF_USER_WORKER tasks should never clear TIF_NEED_FPU_LOAD,
so the TIF_NEED_FPU_LOAD check should equally filter them out.
And this way an exiting userspace task can avoid the unnecessary "fwait"
if it does context_switch() at least once on its way to exit_thread().
Signed-off-by: Oleg Nesterov <oleg@...hat.com>
---
arch/x86/kernel/fpu/core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
index 8d674435f173..fa131299c7da 100644
--- a/arch/x86/kernel/fpu/core.c
+++ b/arch/x86/kernel/fpu/core.c
@@ -693,8 +693,7 @@ void fpu__drop(struct task_struct *tsk)
{
struct fpu *fpu;
- /* PF_KTHREAD tasks do not use the FPU context area: */
- if (tsk->flags & (PF_KTHREAD | PF_USER_WORKER))
+ if (test_tsk_thread_flag(tsk, TIF_NEED_FPU_LOAD))
return;
fpu = x86_task_fpu(tsk);
--
2.25.1.362.g51ebf55
Powered by blists - more mailing lists