linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peng Liu <iwtbavbm@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: mingo@redhat.com, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	bristot@redhat.com, valentin.schneider@arm.com,
	raistlin@linux.it, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 1/2] sched/deadline: optimize sched_dl_global_validate()
Date: Thu, 8 Oct 2020 21:58:07 +0800	[thread overview]
Message-ID: <20201008135807.GA29010@iZj6chx1xj0e0buvshuecpZ> (raw)
In-Reply-To: <20201007165533.GL2628@hirez.programming.kicks-ass.net>

On Wed, Oct 07, 2020 at 06:55:33PM +0200, Peter Zijlstra wrote:
> On Wed, Oct 07, 2020 at 11:12:29PM +0800, Peng Liu wrote:
> > +/* Used for dl_bw check and update. */
> > +static u32 dl_generation;
> 
> > diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> > index 28709f6b0975..53477e8b26b0 100644
> > --- a/kernel/sched/sched.h
> > +++ b/kernel/sched/sched.h
> > @@ -798,6 +798,13 @@ struct root_domain {
> >  	 */
> >  	cpumask_var_t		dlo_mask;
> >  	atomic_t		dlo_count;
> > +
> > +	/*
> > +	 * Indicate whether a root_domain's dl_bw has been checked or
> > +	 * updated. It's monotonously increasing, then wrap around.
> > +	 */
> > +	u32 visit_gen;
> > +
> >  	struct dl_bw		dl_bw;
> >  	struct cpudl		cpudl;
> >  
> > diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> > index dd7770226086..90f3e5558fa2 100644
> > --- a/kernel/sched/topology.c
> > +++ b/kernel/sched/topology.c
> > @@ -516,6 +516,7 @@ static int init_rootdomain(struct root_domain *rd)
> >  	init_irq_work(&rd->rto_push_work, rto_push_irq_work_func);
> >  #endif
> >  
> > +	rd->visit_gen = 0;
> >  	init_dl_bw(&rd->dl_bw);
> >  	if (cpudl_init(&rd->cpudl) != 0)
> >  		goto free_rto_mask;
> 
> I'm fairly sure I made the generation a u64, the above is susceptible to
> a false positive due to wrap-around.
> 
> Increase the generation to -1, create a new root domain, then the next
> generation is 0 and we'll skip the new domain, even though it should be
> updated.

Ah... at first, I also thought that u32 is "big enough" given that
no one would frequently change the settings, 'wrap-around' shouldn't
be a concern.

So...OK, I will revert it back to u64. What a big circle! :)

Thanks for your time!

  reply	other threads:[~2020-10-08 13:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-07 15:11 [PATCH v5 0/2] sched/deadline: Fix and optimize sched_dl_global_validate() Peng Liu
2020-10-07 15:12 ` [PATCH v5 1/2] sched/deadline: " Peng Liu
2020-10-07 16:55   ` Peter Zijlstra
2020-10-08 13:58     ` Peng Liu [this message]
2020-10-07 15:13 ` [PATCH v5 2/2] sched/deadline: Fix sched_dl_global_validate() Peng Liu

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=20201008135807.GA29010@iZj6chx1xj0e0buvshuecpZ \
    --to=iwtbavbm@gmail.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=raistlin@linux.it \
    --cc=rostedt@goodmis.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).