+12
-3
arch/x86/kernel/i387.c
+12
-3
arch/x86/kernel/i387.c
···
86
86
87
87
void __kernel_fpu_end(void)
88
88
{
89
-
if (use_eager_fpu())
90
-
math_state_restore();
91
-
else
89
+
if (use_eager_fpu()) {
90
+
/*
91
+
* For eager fpu, most the time, tsk_used_math() is true.
92
+
* Restore the user math as we are done with the kernel usage.
93
+
* At few instances during thread exit, signal handling etc,
94
+
* tsk_used_math() is false. Those few places will take proper
95
+
* actions, so we don't need to restore the math here.
96
+
*/
97
+
if (likely(tsk_used_math(current)))
98
+
math_state_restore();
99
+
} else {
92
100
stts();
101
+
}
93
102
}
94
103
EXPORT_SYMBOL(__kernel_fpu_end);
95
104