aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSuresh Siddha <suresh.b.siddha@intel.com>2012-05-16 18:03:54 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2012-05-16 18:20:59 -0400
commit1dcc8d7ba235a316a056f993e88f0d18b92c60d9 (patch)
tree0404321ce5a9a8c805f4ead0d2671e9a9227d5c0 /arch
parentd75f1b391f5ef73016d14bc6f7e4725820ebaa5b (diff)
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/process.c19
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)
87 SLAB_PANIC | SLAB_NOTRACK, NULL); 87 SLAB_PANIC | SLAB_NOTRACK, NULL);
88} 88}
89 89
90static inline void drop_fpu(struct task_struct *tsk)
91{
92 /*
93 * Forget coprocessor state..
94 */
95 tsk->fpu_counter = 0;
96 clear_fpu(tsk);
97 clear_used_math();
98}
99
90/* 100/*
91 * Free current thread data structures etc.. 101 * Free current thread data structures etc..
92 */ 102 */
@@ -109,6 +119,8 @@ void exit_thread(void)
109 put_cpu(); 119 put_cpu();
110 kfree(bp); 120 kfree(bp);
111 } 121 }
122
123 drop_fpu(me);
112} 124}
113 125
114void show_regs(struct pt_regs *regs) 126void show_regs(struct pt_regs *regs)
@@ -149,12 +161,7 @@ void flush_thread(void)
149 161
150 flush_ptrace_hw_breakpoint(tsk); 162 flush_ptrace_hw_breakpoint(tsk);
151 memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array)); 163 memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array));
152 /* 164 drop_fpu(tsk);
153 * Forget coprocessor state..
154 */
155 tsk->fpu_counter = 0;
156 clear_fpu(tsk);
157 clear_used_math();
158} 165}
159 166
160static void hard_disable_TSC(void) 167static void hard_disable_TSC(void)