x86/fpu: Optimize fpu__activate_fpstate_read()
authorIngo Molnar <mingo@kernel.org>
Wed, 27 May 2015 10:22:29 +0000 (12:22 +0200)
committerIngo Molnar <mingo@kernel.org>
Wed, 27 May 2015 12:11:25 +0000 (14:11 +0200)
fpu__activate_fpstate_read() is used before FPU registers are
read from the fpstate by ptrace and core dumping.

It's not necessary to unlazy non-current child tasks in this case,
since the reading of registers is non-destructive.

Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Bobby Powers <bobbypowers@gmail.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/kernel/fpu/core.c

index 174add372bb8a15c30d4b0f698756659d43b574e..06cb7e3e9886ef019c44b0111d474d1c417d60fd 100644 (file)
@@ -312,10 +312,7 @@ void fpu__activate_fpstate_read(struct fpu *fpu)
        if (fpu->fpregs_active) {
                fpu__save(fpu);
        } else {
-               if (fpu->fpstate_active) {
-                       /* Invalidate any lazy state: */
-                       fpu->last_cpu = -1;
-               } else {
+               if (!fpu->fpstate_active) {
                        fpstate_init(&fpu->state);
 
                        /* Safe to do for current and for stopped child tasks: */