Re: [PATCH v2 -tip] x86/percpu: Use C for arch_raw_cpu_ptr()

From: Linus Torvalds
Date: Wed Oct 18 2023 - 14:02:00 EST


On Wed, 18 Oct 2023 at 10:08, Uros Bizjak <ubizjak@xxxxxxxxx> wrote:
>
> Sure. Now the patch looks quite slim, but works as expected, reducing
> the number of current_task accesses from 3841 to 3220.

Thanks, that patch looks lovely to me.

Since you've done all the hard lifting and the testing, I'd suggest
you submit this all to the x86, including my fpu patch. Take my
sign-off, and the commit message might be something along the lines of

x86: clean up fpu switching in the middle of task switching

It happens to work, but it's very very wrong, because our 'current'
macro is magic that is supposedly loading a stable value.

It just happens to be not quite stable enough and the compilers
re-load the value enough for this code to work. But it's wrong.

It also generates worse code.

So fix it.

Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

or add any verbiage you feel appropriate.

Linus