Re: [PATCH] x86/resctrl: avoid compiler optimization in __resctrl_sched_in

From: Linus Torvalds
Date: Tue Mar 07 2023 - 16:15:02 EST


On Tue, Mar 7, 2023 at 1:11 PM Luck, Tony <tony.luck@xxxxxxxxx> wrote:
>
> Can you expand about part "a" ... Linux has zillions of static inline functions
> in header files to handle CONFIG options. One version is the real McCoy
> while the other is just a stub for the CONFIG=n case.
>
> What's different about this one?

See the patch I just sent out.

Linux has a lot of "static inline" functions. But that's not at all
what that function was. It was literally just

static void __resctrl_sched_in(..)

which is disgusting and very wrong.

I hope that compilers then just ignored it ("It's static and not used,
so I'm not generating that code"), and that header file isn't included
in very many places, but it's still very wrong.

Linus