summaryrefslogtreecommitdiff
path: root/arch/x86/kernel/fpu/core.c
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-12-13 20:16:40 -0300
committerAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-12-13 20:16:40 -0300
commit6baeafd1f2a54ca041ff71778ebda9fac75aad12 (patch)
tree57d2d68fa5d1d91f57cd7fcf0aed0a97892cc8cc /arch/x86/kernel/fpu/core.c
parent189382f7a338c02b448ab27e1d5566e052165dc8 (diff)
Linux-libre 4.8.14-gnuHEADpck-4.8.14-gnumaster
Diffstat (limited to 'arch/x86/kernel/fpu/core.c')
-rw-r--r--arch/x86/kernel/fpu/core.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
index c289e2f4a..3fc03a09a 100644
--- a/arch/x86/kernel/fpu/core.c
+++ b/arch/x86/kernel/fpu/core.c
@@ -517,14 +517,14 @@ void fpu__clear(struct fpu *fpu)
{
WARN_ON_FPU(fpu != &current->thread.fpu); /* Almost certainly an anomaly */
- fpu__drop(fpu);
-
- /*
- * Make sure fpstate is cleared and initialized.
- */
- if (static_cpu_has(X86_FEATURE_FPU)) {
- fpu__activate_curr(fpu);
- user_fpu_begin();
+ if (!use_eager_fpu() || !static_cpu_has(X86_FEATURE_FPU)) {
+ /* FPU state will be reallocated lazily at the first use. */
+ fpu__drop(fpu);
+ } else {
+ if (!fpu->fpstate_active) {
+ fpu__activate_curr(fpu);
+ user_fpu_begin();
+ }
copy_init_fpstate_to_fpregs();
}
}