x86/fpu: Don't reset thread.fpu_counter
authorOleg Nesterov <oleg@redhat.com>
Fri, 6 Feb 2015 20:01:58 +0000 (15:01 -0500)
committerBorislav Petkov <bp@suse.de>
Thu, 19 Feb 2015 10:12:40 +0000 (11:12 +0100)
The "else" branch clears ->fpu_counter as a remnant of the lazy FPU
usage counting:

  e07e23e1fd30 ("[PATCH] non lazy "sleazy" fpu implementation")

However, switch_fpu_prepare() does this now so that else branch is
superfluous.

If we do use_eager_fpu(), then this has no effect. Otherwise, if we
actually wanted to prevent fpu preload after the context switch we would
need to reset it unconditionally, even if __thread_has_fpu().

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Rik van Riel <riel@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1423252925-14451-2-git-send-email-riel@redhat.com
Signed-off-by: Borislav Petkov <bp@suse.de>
arch/x86/kernel/i387.c

index a9a4229f6161b25b6e8a5752be7943f478525d21..4d0db9ed58e06f02401260b24e0b04a3cc80e62e 100644 (file)
@@ -108,8 +108,7 @@ void unlazy_fpu(struct task_struct *tsk)
        if (__thread_has_fpu(tsk)) {
                __save_init_fpu(tsk);
                __thread_fpu_end(tsk);
-       } else
-               tsk->thread.fpu_counter = 0;
+       }
        preempt_enable();
 }
 EXPORT_SYMBOL(unlazy_fpu);