Re: [PATCH 1/3] sched/rt: cpupri_find: implement fallback mechanism for !fit case
From: Qais Yousef
Date: Tue Feb 18 2020 - 13:53:00 EST
On 02/18/20 13:03, Steven Rostedt wrote:
> On Tue, 18 Feb 2020 17:27:46 +0000
> Qais Yousef <qais.yousef@xxxxxxx> wrote:
>
> > > If we are going to use static branches, then lets just remove the
> > > parameter totally. That is, make two functions (with helpers), where
> > > one needs this fitness function the other does not.
> > >
> > > if (static_branch_unlikely(&sched_asym_cpu_capacity))
> > > ret = cpupri_find_fitness(...);
> > > else
> > > ret = cpupri_find(...);
> > >
> > > if (!ret)
> > > return -1;
> > >
> > > Something like that?
> >
> > Is there any implication on code generation here?
> >
> > I like my flavour better tbh. But I don't mind refactoring the function out if
> > it does make it more readable.
>
> I just figured we remove the passing of the parameter (which does make
> an impact on the code generation).
Ok. My mind went to protecting the whole function call with the static key
could be better.
> Also, perhaps it would be better to not have to pass functions to the
> cpupri_find(). Is there any other function that needs to be past, or
> just this one in this series?
I had that discussion in the past with Dietmar [1]
My argument was this way the code is generic and self contained and allows for
easy extension for other potential users.
I'm happy to split the function into cpupri_find_fitness() (with a fn ptr) and
cpupri_find() (original) like you suggest above - if you're still okay with
that..
[1] https://lore.kernel.org/lkml/39c08971-5d07-8018-915b-9c6284f89d5d@xxxxxxx/
Thanks
--
Qais Youesf