Commit 66ddc2cb authored by Ingo Molnar's avatar Ingo Molnar

x86/fpu: Use 'struct fpu' in fpu_lazy_restore()

Also rename it to fpu_want_lazy_restore(), to better indicate that
this function just tests whether we can do a lazy restore. (The old
name suggested that it was doing the lazy restore, which is not
the case.)
Reviewed-by: default avatarBorislav Petkov <bp@alien8.de>
Cc: Andy Lutomirski <luto@amacapital.net>
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: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent eb6a3251
...@@ -74,10 +74,9 @@ static inline void __cpu_disable_lazy_restore(unsigned int cpu) ...@@ -74,10 +74,9 @@ static inline void __cpu_disable_lazy_restore(unsigned int cpu)
per_cpu(fpu_fpregs_owner_ctx, cpu) = NULL; per_cpu(fpu_fpregs_owner_ctx, cpu) = NULL;
} }
static inline int fpu_lazy_restore(struct task_struct *new, unsigned int cpu) static inline int fpu_want_lazy_restore(struct fpu *fpu, unsigned int cpu)
{ {
return &new->thread.fpu == this_cpu_read_stable(fpu_fpregs_owner_ctx) && return fpu == this_cpu_read_stable(fpu_fpregs_owner_ctx) && cpu == fpu->last_cpu;
cpu == new->thread.fpu.last_cpu;
} }
static inline int is_ia32_compat_frame(void) static inline int is_ia32_compat_frame(void)
...@@ -439,7 +438,7 @@ static inline fpu_switch_t switch_fpu_prepare(struct task_struct *old, struct ta ...@@ -439,7 +438,7 @@ static inline fpu_switch_t switch_fpu_prepare(struct task_struct *old, struct ta
old->thread.fpu.last_cpu = -1; old->thread.fpu.last_cpu = -1;
if (fpu.preload) { if (fpu.preload) {
new->thread.fpu.counter++; new->thread.fpu.counter++;
if (fpu_lazy_restore(new, cpu)) if (fpu_want_lazy_restore(new_fpu, cpu))
fpu.preload = 0; fpu.preload = 0;
else else
prefetch(new->thread.fpu.state); prefetch(new->thread.fpu.state);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment