mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Quentin Perret <quentin.perret@arm.com>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Yuyang Du <yuyang.du@intel.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Morten Rasmussen <morten.rasmussen@arm.com>,
	Patrick Bellasi <patrick.bellasi@arm.com>
Subject: Re: [PATCH] sched/fair: Fix util_avg of new tasks for asymmetric systems
Date: Mon, 4 Jun 2018 15:34:28 +0100	[thread overview]
Message-ID: <20180604143427.GB3311@e108498-lin.cambridge.arm.com> (raw)
In-Reply-To: <CAKfTPtA6L7_UnP-FG4vtKNzC+Dy0HA3g+q=cwjuKs=FFvAgnzg@mail.gmail.com>

On Monday 04 Jun 2018 at 14:23:42 (+0200), Vincent Guittot wrote:
> On 4 June 2018 at 13:58, Quentin Perret <quentin.perret@arm.com> wrote:
> > When a new task wakes-up for the first time, its initial utilization
> > is set to half of the spare capacity of its CPU. The current
> > implementation of post_init_entity_util_avg() uses SCHED_CAPACITY_SCALE
> > directly as a capacity reference. As a result, on a big.LITTLE system, a
> > new task waking up on an idle little CPU will be given ~512 of util_avg,
> > even if the CPU's capacity is significantly less than that.
> >
> > Fix this by computing the spare capacity with arch_scale_cpu_capacity().
> >
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Signed-off-by: Quentin Perret <quentin.perret@arm.com>
> 
> Acked-by: Vincent Guittot <vincent.guittot@linaro.org>

Thanks !

> 
> > ---
> >  kernel/sched/fair.c | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index e497c05aab7f..f19432c17017 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -735,11 +735,12 @@ static void attach_entity_cfs_rq(struct sched_entity *se);
> >   * To solve this problem, we also cap the util_avg of successive tasks to
> >   * only 1/2 of the left utilization budget:
> >   *
> > - *   util_avg_cap = (1024 - cfs_rq->avg.util_avg) / 2^n
> > + *   util_avg_cap = (cpu_scale - cfs_rq->avg.util_avg) / 2^n
> >   *
> > - * where n denotes the nth task.
> > + * where n denotes the nth task and cpu_scale the CPU capacity.
> >   *
> > - * For example, a simplest series from the beginning would be like:
> > + * For example, for a CPU with 1024 of capacity, a simplest series from
> > + * the beginning would be like:
> >   *
> >   *  task  util_avg: 512, 256, 128,  64,  32,   16,    8, ...
> >   * cfs_rq util_avg: 512, 768, 896, 960, 992, 1008, 1016, ...
> > @@ -751,7 +752,8 @@ void post_init_entity_util_avg(struct sched_entity *se)
> >  {
> >         struct cfs_rq *cfs_rq = cfs_rq_of(se);
> >         struct sched_avg *sa = &se->avg;
> > -       long cap = (long)(SCHED_CAPACITY_SCALE - cfs_rq->avg.util_avg) / 2;
> > +       long cpu_scale = arch_scale_cpu_capacity(NULL, cpu_of(rq_of(cfs_rq)));
> > +       long cap = (long)(cpu_scale - cfs_rq->avg.util_avg) / 2;
> >
> >         if (cap > 0) {
> >                 if (cfs_rq->avg.util_avg != 0) {
> > --
> > 2.17.0
> >

      reply	other threads:[~2018-06-04 14:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-04 11:58 Quentin Perret
2018-06-04 12:23 ` Vincent Guittot
2018-06-04 14:34   ` Quentin Perret [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180604143427.GB3311@e108498-lin.cambridge.arm.com \
    --to=quentin.perret@arm.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=morten.rasmussen@arm.com \
    --cc=patrick.bellasi@arm.com \
    --cc=peterz@infradead.org \
    --cc=vincent.guittot@linaro.org \
    --cc=yuyang.du@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®