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 496ea3110aa2..b105c559a073 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
@@ -341,6 +341,7 @@ void flush_thread(void) | |||
341 | /* | 341 | /* |
342 | * Forget coprocessor state.. | 342 | * Forget coprocessor state.. |
343 | */ | 343 | */ |
344 | tsk->fpu_counter = 0; | ||
344 | clear_fpu(tsk); | 345 | clear_fpu(tsk); |
345 | clear_used_math(); | 346 | clear_used_math(); |
346 | } | 347 | } |
@@ -679,8 +680,11 @@ struct task_struct * __switch_to(struct task_struct *prev_p, struct task_struct | |||
679 | /* If the task has used fpu the last 5 timeslices, just do a full | 680 | /* If the task has used fpu the last 5 timeslices, just do a full |
680 | * restore of the math state immediately to avoid the trap; the | 681 | * restore of the math state immediately to avoid the trap; the |
681 | * chances of needing FPU soon are obviously high now | 682 | * chances of needing FPU soon are obviously high now |
683 | * | ||
684 | * tsk_used_math() checks prevent calling math_state_restore(), | ||
685 | * which can sleep in the case of !tsk_used_math() | ||
682 | */ | 686 | */ |
683 | if (next_p->fpu_counter > 5) | 687 | if (tsk_used_math(next_p) && next_p->fpu_counter > 5) |
684 | math_state_restore(); | 688 | math_state_restore(); |
685 | 689 | ||
686 | /* | 690 | /* |