diff options
author | Ingo Molnar <mingo@kernel.org> | 2015-04-03 12:37:30 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-05-19 15:47:12 +0200 |
commit | 6fbe67124869be10e8b0ceedc4ee7c5691d78c40 (patch) | |
tree | ca95cb5725aa263d35b1b600c1eced32d437b1d7 /arch/x86/kernel/i387.c | |
parent | 373244221ade7c4d8d4fa970355ca3803711fbff (diff) | |
download | op-kernel-dev-6fbe67124869be10e8b0ceedc4ee7c5691d78c40.zip op-kernel-dev-6fbe67124869be10e8b0ceedc4ee7c5691d78c40.tar.gz |
x86/fpu: Move fpu_alloc() out of line
This is not a small function, and it's used in several places,
one of them a popular module (KVM).
Move the function out of line. This saves a bit of text,
even with the symbol export overhead:
text data bss dec hex filename
12566052 1619504 1089536 15275092 e91454 vmlinux.before
12566046 1619504 1089536 15275086 e9144e vmlinux.after
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>
Diffstat (limited to 'arch/x86/kernel/i387.c')
-rw-r--r-- | arch/x86/kernel/i387.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c index 5e4dae7..05fcc90 100644 --- a/arch/x86/kernel/i387.c +++ b/arch/x86/kernel/i387.c @@ -246,6 +246,18 @@ void fpu_finit(struct fpu *fpu) } EXPORT_SYMBOL_GPL(fpu_finit); +int fpu_alloc(struct fpu *fpu) +{ + if (fpu->state) + return 0; + fpu->state = kmem_cache_alloc(task_xstate_cachep, GFP_KERNEL); + if (!fpu->state) + return -ENOMEM; + WARN_ON((unsigned long)fpu->state & 15); + return 0; +} +EXPORT_SYMBOL_GPL(fpu_alloc); + /* * Allocate the backing store for the current task's FPU registers * and initialize the registers themselves as well. |