]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - arch/x86/kernel/process.c
x86, fpu: use non-lazy fpu restore for processors supporting xsave
[mirror_ubuntu-artful-kernel.git] / arch / x86 / kernel / process.c
index 30069d1a6a4dd26c46f0ae89724c5e62a89290ef..c21e30f8923b9132597cdb9949ee95135284dd6f 100644 (file)
@@ -66,15 +66,13 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
 {
        int ret;
 
-       unlazy_fpu(src);
-
        *dst = *src;
        if (fpu_allocated(&src->thread.fpu)) {
                memset(&dst->thread.fpu, 0, sizeof(dst->thread.fpu));
                ret = fpu_alloc(&dst->thread.fpu);
                if (ret)
                        return ret;
-               fpu_copy(&dst->thread.fpu, &src->thread.fpu);
+               fpu_copy(dst, src);
        }
        return 0;
 }
@@ -153,7 +151,13 @@ void flush_thread(void)
 
        flush_ptrace_hw_breakpoint(tsk);
        memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array));
-       drop_fpu(tsk);
+       drop_init_fpu(tsk);
+       /*
+        * Free the FPU state for non xsave platforms. They get reallocated
+        * lazily at the first use.
+        */
+       if (!use_xsave())
+               free_thread_xstate(tsk);
 }
 
 static void hard_disable_TSC(void)