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 a30aa1f2607..347a7aba8b1 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
@@ -336,6 +336,7 @@ void flush_thread(void) | |||
336 | /* | 336 | /* |
337 | * Forget coprocessor state.. | 337 | * Forget coprocessor state.. |
338 | */ | 338 | */ |
339 | tsk->fpu_counter = 0; | ||
339 | clear_fpu(tsk); | 340 | clear_fpu(tsk); |
340 | clear_used_math(); | 341 | clear_used_math(); |
341 | } | 342 | } |
@@ -652,8 +653,11 @@ struct task_struct * __switch_to(struct task_struct *prev_p, struct task_struct | |||
652 | /* If the task has used fpu the last 5 timeslices, just do a full | 653 | /* If the task has used fpu the last 5 timeslices, just do a full |
653 | * restore of the math state immediately to avoid the trap; the | 654 | * restore of the math state immediately to avoid the trap; the |
654 | * chances of needing FPU soon are obviously high now | 655 | * chances of needing FPU soon are obviously high now |
656 | * | ||
657 | * tsk_used_math() checks prevent calling math_state_restore(), | ||
658 | * which can sleep in the case of !tsk_used_math() | ||
655 | */ | 659 | */ |
656 | if (next_p->fpu_counter > 5) | 660 | if (tsk_used_math(next_p) && next_p->fpu_counter > 5) |
657 | math_state_restore(); | 661 | math_state_restore(); |
658 | 662 | ||
659 | /* | 663 | /* |