Skip to content

Commit cb3ea4b

Browse files
axboeIngo Molnar
authored andcommitted
x86/fpu: Don't set TIF_NEED_FPU_LOAD for PF_IO_WORKER threads
We don't set it on PF_KTHREAD threads as they never return to userspace, and PF_IO_WORKER threads are identical in that regard. As they keep running in the kernel until they die, skip setting the FPU flag on them. More of a cosmetic thing that was found while debugging and issue and pondering why the FPU flag is set on these threads. Signed-off-by: Jens Axboe <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Acked-by: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent aa81cb9 commit cb3ea4b

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

arch/x86/include/asm/fpu/sched.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ extern void fpu_flush_thread(void);
3939
static inline void switch_fpu_prepare(struct fpu *old_fpu, int cpu)
4040
{
4141
if (cpu_feature_enabled(X86_FEATURE_FPU) &&
42-
!(current->flags & PF_KTHREAD)) {
42+
!(current->flags & (PF_KTHREAD | PF_IO_WORKER))) {
4343
save_fpregs_to_fpstate(old_fpu);
4444
/*
4545
* The save operation preserved register state, so the

arch/x86/kernel/fpu/context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static inline void fpregs_restore_userregs(void)
5757
struct fpu *fpu = &current->thread.fpu;
5858
int cpu = smp_processor_id();
5959

60-
if (WARN_ON_ONCE(current->flags & PF_KTHREAD))
60+
if (WARN_ON_ONCE(current->flags & (PF_KTHREAD | PF_IO_WORKER)))
6161
return;
6262

6363
if (!fpregs_state_valid(fpu, cpu)) {

arch/x86/kernel/fpu/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ void kernel_fpu_begin_mask(unsigned int kfpu_mask)
426426

427427
this_cpu_write(in_kernel_fpu, true);
428428

429-
if (!(current->flags & PF_KTHREAD) &&
429+
if (!(current->flags & (PF_KTHREAD | PF_IO_WORKER)) &&
430430
!test_thread_flag(TIF_NEED_FPU_LOAD)) {
431431
set_thread_flag(TIF_NEED_FPU_LOAD);
432432
save_fpregs_to_fpstate(&current->thread.fpu);

0 commit comments

Comments
 (0)