aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/process_64.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/process_64.c')
-rw-r--r--arch/x86/kernel/process_64.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 9fb3a6fe863b..290183e9731a 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -263,6 +263,7 @@ void flush_thread(void)
263 /* 263 /*
264 * Forget coprocessor state.. 264 * Forget coprocessor state..
265 */ 265 */
266 tsk->fpu_counter = 0;
266 clear_fpu(tsk); 267 clear_fpu(tsk);
267 clear_used_math(); 268 clear_used_math();
268} 269}
@@ -627,8 +628,11 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
627 /* If the task has used fpu the last 5 timeslices, just do a full 628 /* If the task has used fpu the last 5 timeslices, just do a full
628 * restore of the math state immediately to avoid the trap; the 629 * restore of the math state immediately to avoid the trap; the
629 * chances of needing FPU soon are obviously high now 630 * chances of needing FPU soon are obviously high now
631 *
632 * tsk_used_math() checks prevent calling math_state_restore(),
633 * which can sleep in the case of !tsk_used_math()
630 */ 634 */
631 if (next_p->fpu_counter>5) 635 if (tsk_used_math(next_p) && next_p->fpu_counter > 5)
632 math_state_restore(); 636 math_state_restore();
633 return prev_p; 637 return prev_p;
634} 638}