Commit 6a5fe895 authored by Rik van Riel's avatar Rik van Riel Committed by Borislav Petkov

x86/fpu: Use task_disable_lazy_fpu_restore() helper

Replace magic assignments of fpu.last_cpu = ~0 with more explicit
task_disable_lazy_fpu_restore() calls.
Signed-off-by: default avatarRik van Riel <riel@redhat.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1423252925-14451-8-git-send-email-riel@redhat.comSigned-off-by: default avatarBorislav Petkov <bp@suse.de>
parent 1361ef29
...@@ -439,7 +439,7 @@ static inline fpu_switch_t switch_fpu_prepare(struct task_struct *old, struct ta ...@@ -439,7 +439,7 @@ static inline fpu_switch_t switch_fpu_prepare(struct task_struct *old, struct ta
if (__thread_has_fpu(old)) { if (__thread_has_fpu(old)) {
if (!__save_init_fpu(old)) if (!__save_init_fpu(old))
old->thread.fpu.last_cpu = ~0; task_disable_lazy_fpu_restore(old);
else else
old->thread.fpu.last_cpu = cpu; old->thread.fpu.last_cpu = cpu;
...@@ -455,7 +455,7 @@ static inline fpu_switch_t switch_fpu_prepare(struct task_struct *old, struct ta ...@@ -455,7 +455,7 @@ static inline fpu_switch_t switch_fpu_prepare(struct task_struct *old, struct ta
stts(); stts();
} else { } else {
old->thread.fpu_counter = 0; old->thread.fpu_counter = 0;
old->thread.fpu.last_cpu = ~0; task_disable_lazy_fpu_restore(old);
if (fpu.preload) { if (fpu.preload) {
new->thread.fpu_counter++; new->thread.fpu_counter++;
if (!use_eager_fpu() && fpu_lazy_restore(new, cpu)) if (!use_eager_fpu() && fpu_lazy_restore(new, cpu))
......
...@@ -236,7 +236,7 @@ int init_fpu(struct task_struct *tsk) ...@@ -236,7 +236,7 @@ int init_fpu(struct task_struct *tsk)
if (tsk_used_math(tsk)) { if (tsk_used_math(tsk)) {
if (cpu_has_fpu && tsk == current) if (cpu_has_fpu && tsk == current)
unlazy_fpu(tsk); unlazy_fpu(tsk);
tsk->thread.fpu.last_cpu = ~0; task_disable_lazy_fpu_restore(tsk);
return 0; return 0;
} }
......
...@@ -68,8 +68,8 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) ...@@ -68,8 +68,8 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
dst->thread.fpu_counter = 0; dst->thread.fpu_counter = 0;
dst->thread.fpu.has_fpu = 0; dst->thread.fpu.has_fpu = 0;
dst->thread.fpu.last_cpu = ~0;
dst->thread.fpu.state = NULL; dst->thread.fpu.state = NULL;
task_disable_lazy_fpu_restore(dst);
if (tsk_used_math(src)) { if (tsk_used_math(src)) {
int err = fpu_alloc(&dst->thread.fpu); int err = fpu_alloc(&dst->thread.fpu);
if (err) if (err)
......
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