[PATCH 0/3, v3] x86/fpu: Remove the thread::fpu pointer

From: Ingo Molnar
Date: Wed Jun 05 2024 - 04:41:39 EST


This series is one of the dependencies of the fast-headers work,
which aims to reduce header complexity by removing <asm/processor.h>
from the <linux/sched.h> dependency chain, which headers are headers
are fat enough already even if we do not combine them.

To achieve that decoupling, one of the key steps is to not embedd any
C types from <asm/processor.h> into task_struct.

The only architecture that relies on that in a serious fashion is x86,
via 'struct thread::fpu', and the series below attempts to resolve it
by using a calculated &task->thread.fpu value via the x86_task_fpu()
helper.

Code generation: without CONFIG_X86_DEBUG_FPU=y we get a small reduction:

text data bss dec hex filename
26475783 10439082 1740804 38655669 24dd6b5 vmlinux.before
26475601 10435146 1740804 38651551 24dc69f vmlinux.after

With the new debug code - which I think we'll remove soon-ish, there's an
expected increase:

text data bss dec hex filename
26476198 10439286 1740804 38656288 24dd920 vmlinux.CONFIG_X86_DEBUG_FPU.before
26477000 10435458 1740804 38653262 24dcd4e vmlinux.CONFIG_X86_DEBUG_FPU.after

The Git tree can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.x86/fpu

Thanks,

Ingo

===============>
Ingo Molnar (3):
x86/fpu: Make task_struct::thread constant size
x86/fpu: Remove the thread::fpu pointer
x86/fpu: Remove init_task FPU state dependencies, add debugging warning

arch/x86/include/asm/fpu/sched.h | 2 +-
arch/x86/include/asm/processor.h | 19 ++++++++++---------
arch/x86/kernel/fpu/context.h | 4 ++--
arch/x86/kernel/fpu/core.c | 57 +++++++++++++++++++++++++++++++--------------------------
arch/x86/kernel/fpu/init.c | 23 +++++++++++++----------
arch/x86/kernel/fpu/regset.c | 22 +++++++++++-----------
arch/x86/kernel/fpu/signal.c | 18 +++++++++---------
arch/x86/kernel/fpu/xstate.c | 23 ++++++++++-------------
arch/x86/kernel/fpu/xstate.h | 6 +++---
arch/x86/kernel/process.c | 6 ++----
arch/x86/kernel/signal.c | 6 +++---
arch/x86/kernel/traps.c | 2 +-
arch/x86/math-emu/fpu_aux.c | 2 +-
arch/x86/math-emu/fpu_entry.c | 4 ++--
arch/x86/math-emu/fpu_system.h | 2 +-
arch/x86/mm/extable.c | 2 +-
include/linux/sched.h | 13 +++----------
17 files changed, 104 insertions(+), 107 deletions(-)

--
2.43.0