All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rik van Riel <riel@surriel.com>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Kernel Team <kernel-team@fb.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <valentin.schneider@arm.com>
Subject: Re: [PATCH v2] sched,fair: skip newidle_balance if a wakeup is pending
Date: Tue, 20 Apr 2021 11:20:36 -0400	[thread overview]
Message-ID: <5e21452a727dcd6d3257496a2c42f49bd16e9cb5.camel@surriel.com> (raw)
In-Reply-To: <CAKfTPtDjEMJeoZgE1an9Nh9QZPc2gJetsZHL+8QAWzqX5_znvw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1398 bytes --]

On Tue, 2021-04-20 at 11:04 +0200, Vincent Guittot wrote:
> On Mon, 19 Apr 2021 at 18:51, Rik van Riel <riel@surriel.com> wrote:
> > 
> > @@ -10688,7 +10697,7 @@ static int newidle_balance(struct rq
> > *this_rq, struct rq_flags *rf)
> >         if (this_rq->nr_running != this_rq->cfs.h_nr_running)
> >                 pulled_task = -1;
> > 
> > -       if (pulled_task)
> > +       if (pulled_task || this_rq->ttwu_pending)
> 
> This needs at least a comment to explain why we must clear
> this_rq->idle_stamp when this_rq->ttwu_pending is set whereas it is
> also done during sched_ttwu_pending()
> 
> >                 this_rq->idle_stamp = 0;

I spent some time staring at sched_ttwu_pending and
the functions it calls, but I can't seem to spot
where it clears rq->idle_stamp, except inside
ttwu_do_wakeup where it will end up adding a
non-idle period into the rq->avg_idle, which seems
wrong.

If we are actually idle, and get woken up with a
ttwu_queue task, we do not come through newidle_balance,
and we end up counting the idle time into the avg_idle
number.

However, if a task is woken up while the CPU is
in newidle_balance, because prev != idle, we should
not count that period towards rq->avg_idle, for
the same reason we do so when we pulled a task.

I'll add a comment in v3 explaining why idle_stamp
needs to be 0.

-- 
All Rights Reversed.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2021-04-20 15:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19 16:51 [PATCH v2] sched,fair: skip newidle_balance if a wakeup is pending Rik van Riel
2021-04-20  9:04 ` Vincent Guittot
2021-04-20 15:20   ` Rik van Riel [this message]
2021-04-20 15:44     ` Vincent Guittot

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=5e21452a727dcd6d3257496a2c42f49bd16e9cb5.camel@surriel.com \
    --to=riel@surriel.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=valentin.schneider@arm.com \
    --cc=vincent.guittot@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.