diff options
author | Suresh Siddha <suresh.b.siddha@intel.com> | 2012-05-17 00:03:54 +0200 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2012-05-17 00:20:59 +0200 |
commit | 1dcc8d7ba235a316a056f993e88f0d18b92c60d9 (patch) | |
tree | 0404321ce5a9a8c805f4ead0d2671e9a9227d5c0 | |
parent | x86, xsave: remove thread_has_fpu() bug check in __sanitize_i387_state() (diff) | |
download | linux-1dcc8d7ba235a316a056f993e88f0d18b92c60d9.tar.xz linux-1dcc8d7ba235a316a056f993e88f0d18b92c60d9.zip |
x86, fpu: drop the fpu state during thread exit
There is no need to save any active fpu state to the task structure
memory if the task is dead. Just drop the state instead.
For example, this saved some 1770 xsave's during the system boot
of a two socket Xeon system.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Link: http://lkml.kernel.org/r/1336692811-30576-4-git-send-email-suresh.b.siddha@intel.com
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r-- | arch/x86/kernel/process.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index b7e1e0e53987..1219fe2be8f3 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -87,6 +87,16 @@ void arch_task_cache_init(void) SLAB_PANIC | SLAB_NOTRACK, NULL); } +static inline void drop_fpu(struct task_struct *tsk) +{ + /* + * Forget coprocessor state.. + */ + tsk->fpu_counter = 0; + clear_fpu(tsk); + clear_used_math(); +} + /* * Free current thread data structures etc.. */ @@ -109,6 +119,8 @@ void exit_thread(void) put_cpu(); kfree(bp); } + + drop_fpu(me); } void show_regs(struct pt_regs *regs) @@ -149,12 +161,7 @@ void flush_thread(void) flush_ptrace_hw_breakpoint(tsk); memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array)); - /* - * Forget coprocessor state.. - */ - tsk->fpu_counter = 0; - clear_fpu(tsk); - clear_used_math(); + drop_fpu(tsk); } static void hard_disable_TSC(void) |