[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190606025444.etxgxny6hosoa74z@vireshk-i7>
Date: Thu, 6 Jun 2019 08:24:44 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Peter Oskolkov <posk@...k.io>
Cc: Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Vincent Guittot <vincent.guittot@...aro.org>
Subject: Re: [PATCH] sched/fair: Introduce fits_capacity()
On 04-06-19, 08:59, Peter Oskolkov wrote:
> On Tue, Jun 4, 2019 at 12:02 AM Viresh Kumar <viresh.kumar@...aro.org> wrote:
> >
> > The same formula to check utilization against capacity (after
> > considering capacity_margin) is already used at 5 different locations.
> >
> > This patch creates a new macro, fits_capacity(), which can be used from
> > all these locations without exposing the details of it and hence
> > simplify code.
> >
> > All the 5 code locations are updated as well to use it..
> >
> > Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
> > ---
> > kernel/sched/fair.c | 14 +++++++-------
> > 1 file changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 7f8d477f90fe..db3a218b7928 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -102,6 +102,8 @@ int __weak arch_asym_cpu_priority(int cpu)
> > * (default: ~20%)
> > */
> > static unsigned int capacity_margin = 1280;
> > +
> > +#define fits_capacity(cap, max) ((cap) * capacity_margin < (max) * 1024)
>
> Any reason to have this as a macro and not as an inline function?
I don't have any strong preference here, I used a macro as I didn't
feel that type-checking is really required on the parameters and
eventually this will get open coded anyway.
Though I would be fine to make it a routine if maintainers want it
that way.
Thanks Peter.
--
viresh
Powered by blists - more mailing lists