On Tue, Jun 04, 2019 at 09:15:23AM +0200, Christoph Hellwig wrote: > +void kernel_fpu_begin(void) > { > + preempt_disable(); > > WARN_ON_FPU(!irq_fpu_usable()); > + WARN_ON_FPU(this_cpu_read(in_kernel_fpu)); > > + this_cpu_write(in_kernel_fpu, true); > > + if (current->mm && !test_thread_flag(TIF_NEED_FPU_LOAD)) {
Did that want to be: !(current->flags & PF_KTHREAD), instead? Because I'm thinking that kernel_fpu_begin() on a kthread that has use_mm() employed shouldn't be doing this.. > + set_thread_flag(TIF_NEED_FPU_LOAD); > + /* > + * Ignore return value -- we don't care if reg state > + * is clobbered. > + */ > + copy_fpregs_to_fpstate(¤t->thread.fpu); > } > __cpu_invalidate_fpregs_state(); > }