From: Peter Zijlstra <peterz@infradead.org>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: mingo@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] sched/pelt: fix update_blocked_averages() for dl and rt
Date: Fri, 31 Aug 2018 17:10:49 +0200 [thread overview]
Message-ID: <20180831151049.GB24142@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20180831150721.GP24124@hirez.programming.kicks-ass.net>
On Fri, Aug 31, 2018 at 05:07:21PM +0200, Peter Zijlstra wrote:
> On Fri, Aug 31, 2018 at 04:56:19PM +0200, Vincent Guittot wrote:
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 309c93f..bc1de21 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -7262,6 +7262,7 @@ static void update_blocked_averages(int cpu)
> > {
> > struct rq *rq = cpu_rq(cpu);
> > struct cfs_rq *cfs_rq, *pos;
> > + const struct sched_class *curr_class = rq->curr->sched_class;
> > struct rq_flags rf;
> > bool done = true;
>
> Can you do me a v3 where you move that rq->curr dereference under the
> rq->lock?
>
> I _think_ it is actually OK, but it is really dodgy. Moving it under
> rq->lock makes it obvious correct.
Ah, it is not correct. I only checked to see if preemption was disabled
and if we're calling this on the local CPU (which I think is true),
which would guarantee rq->curr's existence.
But that is not sufficient to make rq->curr->sched_class stable.
> > @@ -7298,8 +7299,8 @@ static void update_blocked_averages(int cpu)
> > if (cfs_rq_has_blocked(cfs_rq))
> > done = false;
> > }
> > - update_rt_rq_load_avg(rq_clock_task(rq), rq, 0);
> > - update_dl_rq_load_avg(rq_clock_task(rq), rq, 0);
> > + update_rt_rq_load_avg(rq_clock_task(rq), rq, curr_class == &rt_sched_class);
> > + update_dl_rq_load_avg(rq_clock_task(rq), rq, curr_class == &dl_sched_class);
> > update_irq_load_avg(rq, 0);
> > /* Don't need periodic decay once load/util_avg are null */
> > if (others_have_blocked(rq))
prev parent reply other threads:[~2018-08-31 15:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-31 14:56 [PATCH v2] sched/pelt: fix update_blocked_averages() for dl and rt Vincent Guittot
2018-08-31 15:07 ` Peter Zijlstra
2018-08-31 15:10 ` Vincent Guittot
2018-08-31 15:10 ` Peter Zijlstra [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=20180831151049.GB24142@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox