x86/fpu, sched: Dynamically allocate 'struct fpu'
authorDave Hansen <[email protected]>
Fri, 17 Jul 2015 10:28:11 +0000 (12:28 +0200)
committerIngo Molnar <[email protected]>
Sat, 18 Jul 2015 01:42:35 +0000 (03:42 +0200)
commit0c8c0f03e3a292e031596484275c14cf39c0ab7a
treec1d012c83722e9fa3b7bc152e64697828f6cbc35
parenta97439aa1aec10387797b4abae3cf117de1c90d7
x86/fpu, sched: Dynamically allocate 'struct fpu'

The FPU rewrite removed the dynamic allocations of 'struct fpu'.
But, this potentially wastes massive amounts of memory (2k per
task on systems that do not have AVX-512 for instance).

Instead of having a separate slab, this patch just appends the
space that we need to the 'task_struct' which we dynamically
allocate already.  This saves from doing an extra slab
allocation at fork().

The only real downside here is that we have to stick everything
and the end of the task_struct.  But, I think the
BUILD_BUG_ON()s I stuck in there should keep that from being too
fragile.

Signed-off-by: Dave Hansen <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Brian Gerst <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Denys Vlasenko <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
arch/x86/include/asm/fpu/types.h
arch/x86/include/asm/processor.h
arch/x86/kernel/fpu/init.c
arch/x86/kernel/process.c
fs/proc/kcore.c
include/linux/sched.h
kernel/fork.c