aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/kernel/i387.c
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2014-03-28 10:58:52 +0800
committerAlex Shi <alex.shi@linaro.org>2014-03-28 10:58:52 +0800
commit02e11cd17332186b4cf9ed88db6e63b30043be54 (patch)
treebc3a5683d5d3139e1825b69796fb8480808ba46f /arch/x86/kernel/i387.c
parentd3222d77b27a07a4b200d1b0b792e8e3bdf30396 (diff)
parent10f8245e0d3650144b034142c8f91e5d15c392ab (diff)
Merge tag 'v3.10.34' into linux-linaro-lsk
This is 3.10.34 stable release
Diffstat (limited to 'arch/x86/kernel/i387.c')
-rw-r--r--arch/x86/kernel/i387.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index f7ea30dce23..b03ff184254 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -86,10 +86,19 @@ EXPORT_SYMBOL(__kernel_fpu_begin);
void __kernel_fpu_end(void)
{
- if (use_eager_fpu())
- math_state_restore();
- else
+ if (use_eager_fpu()) {
+ /*
+ * For eager fpu, most the time, tsk_used_math() is true.
+ * Restore the user math as we are done with the kernel usage.
+ * At few instances during thread exit, signal handling etc,
+ * tsk_used_math() is false. Those few places will take proper
+ * actions, so we don't need to restore the math here.
+ */
+ if (likely(tsk_used_math(current)))
+ math_state_restore();
+ } else {
stts();
+ }
}
EXPORT_SYMBOL(__kernel_fpu_end);