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

From: Linus Torvalds
Date: Tue Mar 07 2023 - 16:19:33 EST


On Tue, Mar 7, 2023 at 1:16 PM Nick Desaulniers <ndesaulniers@xxxxxxxxxx> 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.
>
> Right, I had the same question.
>
> Perhaps it's more so that no one calls __resctrl_sched_in, only
> resctrl_sched_in, therefor they should be folded into one function?

If you think it should be inlined, it should be marked as such.

And if you *don't* think it should be inlined - quite possibly the
right answer here - the definition of that function damn well
shouldn't be in a header file.

So either way, that __resctrl_sched_in() was wrong, wrong, wrong.

Linus