Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/fpu: Remove the free_thread_xstate() complication

Use fpstate_free() directly to manage FPU state.

Only process.c was using this method, so this is a speedup as well,
as it removes the extra function call and related clobbers.

Reviewed-by: Borislav Petkov <bp@alien8.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>

+2 -8
-1
arch/x86/include/asm/processor.h
··· 362 362 #endif /* X86_64 */ 363 363 364 364 extern unsigned int xstate_size; 365 - extern void free_thread_xstate(struct task_struct *); 366 365 extern struct kmem_cache *task_xstate_cachep; 367 366 368 367 struct perf_event;
+2 -7
arch/x86/kernel/process.c
··· 99 99 return 0; 100 100 } 101 101 102 - void free_thread_xstate(struct task_struct *tsk) 103 - { 104 - fpstate_free(&tsk->thread.fpu); 105 - } 106 - 107 102 void arch_release_task_struct(struct task_struct *tsk) 108 103 { 109 - free_thread_xstate(tsk); 104 + fpstate_free(&tsk->thread.fpu); 110 105 } 111 106 112 107 void arch_task_cache_init(void) ··· 149 154 if (!use_eager_fpu()) { 150 155 /* FPU state will be reallocated lazily at the first use. */ 151 156 drop_fpu(tsk); 152 - free_thread_xstate(tsk); 157 + fpstate_free(&tsk->thread.fpu); 153 158 } else { 154 159 if (!tsk_used_math(tsk)) { 155 160 /* kthread execs. TODO: cleanup this horror. */