From: Morten Rasmussen <morten.rasmussen@arm.com>
To: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Yuyang Du <yuyang.du@intel.com>, Leo Yan <leo.yan@linaro.org>,
Steve Muckle <steve.muckle@linaro.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
linux-kernel@vger.kernel.org, eas-dev@lists.linaro.org
Subject: Re: [PATCH RFC] sched/fair: let cpu's cfs_rq to reflect task migration
Date: Wed, 6 Apr 2016 09:37:04 +0100 [thread overview]
Message-ID: <20160406083702.GE18516@e105550-lin.cambridge.arm.com> (raw)
In-Reply-To: <5703EF38.2060204@arm.com>
On Tue, Apr 05, 2016 at 06:00:40PM +0100, Dietmar Eggemann wrote:
> @@ -2893,8 +2906,12 @@ static void attach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *s
> se->avg.last_update_time = cfs_rq->avg.last_update_time;
> cfs_rq->avg.load_avg += se->avg.load_avg;
> cfs_rq->avg.load_sum += se->avg.load_sum;
> - cfs_rq->avg.util_avg += se->avg.util_avg;
> - cfs_rq->avg.util_sum += se->avg.util_sum;
> +
> + if (!entity_is_task(se))
> + return;
> +
> + rq_of(cfs_rq)->cfs.avg.util_avg += se->avg.util_avg;
> + rq_of(cfs_rq)->cfs.avg.util_sum += se->avg.util_sum;
To me it seems that you cannot be sure that the rq_of(cfs_rq)->cfs.avg
time stamp is aligned with se->avg time stamp, which is necessary before
you can add/subtract two geometric series without introducing an error.
attach_entity_load_avg() is called (through a couple of other functions)
from the for_each_sched_entity() loop in enqueue_task_fair() which works
its way towards the root cfs_rq, i.e. rq_of(cfs_rq)->cfs. So in the loop
iteration where you attach the task sched_entity, we haven't yet visited
and updated rq_of(cfs_rq)->cfs.avg.
If you just add the task contribution and discover later that there is a
time delta when you update rq_of(cfs_rq)->cfs.avg you end up decaying
the task contribution which was already up-to-date and its util
contribution to rq_of(cfs_rq)->cfs.avg ends up being smaller than it
should be.
Am I missing something?
next prev parent reply other threads:[~2016-04-06 8:34 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-01 16:38 Leo Yan
2016-04-01 19:49 ` Peter Zijlstra
2016-04-01 22:28 ` Steve Muckle
2016-04-02 7:11 ` Leo Yan
2016-04-04 8:48 ` Morten Rasmussen
2016-04-04 18:30 ` Yuyang Du
2016-04-05 7:51 ` Morten Rasmussen
2016-04-05 0:15 ` Yuyang Du
2016-04-05 17:00 ` Dietmar Eggemann
2016-04-06 8:37 ` Morten Rasmussen [this message]
2016-04-06 12:14 ` Vincent Guittot
2016-04-06 18:53 ` Dietmar Eggemann
2016-04-07 13:04 ` Vincent Guittot
2016-04-07 20:30 ` Dietmar Eggemann
2016-04-08 6:05 ` Vincent Guittot
2016-04-05 6:56 ` Leo Yan
2016-04-05 9:13 ` Morten Rasmussen
2016-04-04 9:01 ` Morten Rasmussen
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=20160406083702.GE18516@e105550-lin.cambridge.arm.com \
--to=morten.rasmussen@arm.com \
--cc=dietmar.eggemann@arm.com \
--cc=eas-dev@lists.linaro.org \
--cc=leo.yan@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=steve.muckle@linaro.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®