x86/fpu: kill the PF_KTHREAD|PF_USER_WORKER check in switch_fpu() and kernel_fpu_begin_mask()
PATCH 1/1 x86/fpu: kill the PF_KTHREAD|PF_USER_WORKER check in switch_fpu() and kernel_fpu_begin_mask()
PF_KTHREAD | PF_USER_WORKER kernel threads do not use their FPU context, this means that TIF_NEED_FPU_LOAD must be always set, we can remove the unnecessary "PF_KTHREAD | PF_USER_WORKER" check.
Signed-off-by Oleg Nesterov <[email protected]>
--- arch/x86/include/asm/fpu/sched.h | 3 +-- arch/x86/kernel/fpu/core.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
arch/x86/include/asm/fpu/sched.h +1 -2
@@ -32,8 +32,7 @@ extern void fpu_flush_thread(void);static inline void switch_fpu (struct task_struct *old,int cpu) {if (!test_tsk_thread_flag (old,TIF_NEED_FPU_LOAD ) && -cpu_feature_enabled (X86_FEATURE_FPU ) && - !(old->flags & (PF_KTHREAD |PF_USER_WORKER ))) { +cpu_feature_enabled (X86_FEATURE_FPU )) {struct fpu *old_fpu =x86_task_fpu (old);set_tsk_thread_flag (old,TIF_NEED_FPU_LOAD );
arch/x86/kernel/fpu/core.c +1 -2
@@ -453,8 +453,7 @@ void kernel_fpu_begin_mask(unsigned int kfpu_mask)WARN_ON_FPU (!this_cpu_read (kernel_fpu_allowed));this_cpu_write (kernel_fpu_allowed, false); -if (!(current->flags & (PF_KTHREAD |PF_USER_WORKER )) && - !test_thread_flag (TIF_NEED_FPU_LOAD )) { +if (!test_thread_flag (TIF_NEED_FPU_LOAD )) {set_thread_flag (TIF_NEED_FPU_LOAD );save_fpregs_to_fpstate (x86_task_fpu (current)); }
Signature · 1 line
2.25.1.362.g51ebf55