diff options
Diffstat (limited to 'arch/x86/kernel/process_32.c')
-rw-r--r-- | arch/x86/kernel/process_32.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index ae4020486a97..c2a11d77b1b5 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
@@ -274,6 +274,7 @@ void flush_thread(void) | |||
274 | /* | 274 | /* |
275 | * Forget coprocessor state.. | 275 | * Forget coprocessor state.. |
276 | */ | 276 | */ |
277 | tsk->fpu_counter = 0; | ||
277 | clear_fpu(tsk); | 278 | clear_fpu(tsk); |
278 | clear_used_math(); | 279 | clear_used_math(); |
279 | } | 280 | } |
@@ -590,8 +591,11 @@ struct task_struct * __switch_to(struct task_struct *prev_p, struct task_struct | |||
590 | /* If the task has used fpu the last 5 timeslices, just do a full | 591 | /* If the task has used fpu the last 5 timeslices, just do a full |
591 | * restore of the math state immediately to avoid the trap; the | 592 | * restore of the math state immediately to avoid the trap; the |
592 | * chances of needing FPU soon are obviously high now | 593 | * chances of needing FPU soon are obviously high now |
594 | * | ||
595 | * tsk_used_math() checks prevent calling math_state_restore(), | ||
596 | * which can sleep in the case of !tsk_used_math() | ||
593 | */ | 597 | */ |
594 | if (next_p->fpu_counter > 5) | 598 | if (tsk_used_math(next_p) && next_p->fpu_counter > 5) |
595 | math_state_restore(); | 599 | math_state_restore(); |
596 | 600 | ||
597 | /* | 601 | /* |