Re: [PATCH 0000/2297] [ANNOUNCE, RFC] "Fast Kernel Headers" Tree -v1: Eliminate the Linux kernel's "Dependency Hell"

From: Peter Zijlstra
Date: Mon Jan 10 2022 - 05:28:39 EST


On Mon, Jan 03, 2022 at 05:29:02PM +0100, Ingo Molnar wrote:
> Yeah, so I *did* find this somewhat suboptimal too, and developed an
> earlier version that used linker section tricks to gain the field offsets
> more automatically.
>
> It was an unmitigated disaster: was fragile on x86 already (which has a zoo
> of linking quirks with no precedent of doing this before bounds.c
> processing), but on ARM64 and probably on most of the other RISC-ish
> architectures there was also a real runtime code generation cost of using
> linker tricks: 2-3 extra instructions per per_task() use - clearly
> unacceptable.
>
> Found this out the hard way after making it boot & work on ARM64 and
> looking at the assembly output, trying to figure out why the generated code
> size increased. :-/

Right, I suggested you do the per-cpu thing. And then Mark reported that
code-gen issue on arm64.

I'm still thinking the toolchains ought to look at fixing that. It'll be
too late to use for per-task, but at least the current per-cpu usages
will (eventually) get better code-gen.