From: Ingo Molnar Date: Wed, 27 May 2015 10:22:29 +0000 (+0200) Subject: x86/fpu: Optimize fpu__activate_fpstate_read() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9ba6b79102a594293c79f30319cabf476c5e300e;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git x86/fpu: Optimize fpu__activate_fpstate_read() 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 Cc: Bobby Powers Cc: Borislav Petkov Cc: Dave Hansen Cc: Fenghua Yu Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Oleg Nesterov Cc: Thomas Gleixner Signed-off-by: Ingo Molnar --- diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c index 174add372bb8..06cb7e3e9886 100644 --- a/arch/x86/kernel/fpu/core.c +++ b/arch/x86/kernel/fpu/core.c @@ -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: */