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

From: Nick Desaulniers
Date: Tue Mar 07 2023 - 16:23:02 EST


On Tue, Mar 7, 2023 at 1:19 PM Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> 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.

Yep, sorry, I missed that `inline` was missing from that definition!

>
> 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
>


--
Thanks,
~Nick Desaulniers