File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -536,7 +536,7 @@ static inline void __fpregs_load_activate(void)
536536 struct fpu * fpu = & current -> thread .fpu ;
537537 int cpu = smp_processor_id ();
538538
539- if (WARN_ON_ONCE (current -> mm == NULL ))
539+ if (WARN_ON_ONCE (current -> flags & PF_KTHREAD ))
540540 return ;
541541
542542 if (!fpregs_state_valid (fpu , cpu )) {
@@ -567,11 +567,11 @@ static inline void __fpregs_load_activate(void)
567567 * otherwise.
568568 *
569569 * The FPU context is only stored/restored for a user task and
570- * ->mm is used to distinguish between kernel and user threads.
570+ * PF_KTHREAD is used to distinguish between kernel and user threads.
571571 */
572572static inline void switch_fpu_prepare (struct fpu * old_fpu , int cpu )
573573{
574- if (static_cpu_has (X86_FEATURE_FPU ) && current -> mm ) {
574+ if (static_cpu_has (X86_FEATURE_FPU ) && !( current -> flags & PF_KTHREAD ) ) {
575575 if (!copy_fpregs_to_fpstate (old_fpu ))
576576 old_fpu -> last_cpu = -1 ;
577577 else
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ static void __kernel_fpu_begin(void)
102102
103103 kernel_fpu_disable ();
104104
105- if (current -> mm ) {
105+ if (!( current -> flags & PF_KTHREAD ) ) {
106106 if (!test_thread_flag (TIF_NEED_FPU_LOAD )) {
107107 set_thread_flag (TIF_NEED_FPU_LOAD );
108108 /*
You can’t perform that action at this time.
0 commit comments