[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <174634886289.22196.15264637778984869937.tip-bot2@tip-bot2>
Date: Sun, 04 May 2025 08:54:22 -0000
From: "tip-bot2 for Oleg Nesterov" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Oleg Nesterov <oleg@...hat.com>, Ingo Molnar <mingo@...nel.org>,
"Chang S . Bae" <chang.seok.bae@...el.com>, "H. Peter Anvin" <hpa@...or.com>,
Andy Lutomirski <luto@...capital.net>, Brian Gerst <brgerst@...il.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: x86/fpu] x86/fpu: Check TIF_NEED_FPU_LOAD instead of
PF_KTHREAD|PF_USER_WORKER in fpu__drop()
The following commit has been merged into the x86/fpu branch of tip:
Commit-ID: 016a2e6f8ae5ed544ba8fb2b6d78f64ddfd9d01b
Gitweb: https://git.kernel.org/tip/016a2e6f8ae5ed544ba8fb2b6d78f64ddfd9d01b
Author: Oleg Nesterov <oleg@...hat.com>
AuthorDate: Sat, 03 May 2025 16:38:56 +02:00
Committer: Ingo Molnar <mingo@...nel.org>
CommitterDate: Sun, 04 May 2025 10:29:25 +02:00
x86/fpu: Check TIF_NEED_FPU_LOAD instead of PF_KTHREAD|PF_USER_WORKER in fpu__drop()
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>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Cc: Chang S . Bae <chang.seok.bae@...el.com>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Andy Lutomirski <luto@...capital.net>
Cc: Brian Gerst <brgerst@...il.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Link: https://lore.kernel.org/r/20250503143856.GA9009@redhat.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 8d67443..fa13129 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);
Powered by blists - more mailing lists