mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Byungchul Park <byungchul.park@lge.com>
To: Juri Lelli <juri.lelli@arm.com>
Cc: peterz@infradead.org, mingo@kernel.org,
	linux-kernel@vger.kernel.org, juri.lelli@gmail.com,
	rostedt@goodmis.org, kernel-team@lge.com
Subject: Re: [PATCH 2/2] sched/deadline: Don't return invalid cpu in cpudl_maximum_cpu()
Date: Mon, 12 Jun 2017 10:43:08 +0900	[thread overview]
Message-ID: <20170612014307.GH3623@X58A-UD3R> (raw)
In-Reply-To: <20170609114206.jy7hyr6xnmwwipg5@e106622-lin>

On Fri, Jun 09, 2017 at 12:42:06PM +0100, Juri Lelli wrote:
> > 
> > This would also work and avoid unnecessary warning. I missed the check
> > to avoid it. https://lkml.org/lkml/2017/3/23/175 was an original patch
> > doing it.
> > 
> > By the way, frankly speaking, I don't like accessing the cpudl instant
> > several times without protection. I rather prefer the following..
> > 
> > But whatever. I like both.
> > 
> > Thnaks,
> > Byungchul
> > 
> > ----->8-----
> > diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
> > index 9b314a9..1d369cf 100644
> > --- a/kernel/sched/cpudeadline.c
> > +++ b/kernel/sched/cpudeadline.c
> > @@ -137,11 +137,17 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p,
> >  	    cpumask_and(later_mask, cp->free_cpus, &p->cpus_allowed)) {
> >  		best_cpu = cpumask_any(later_mask);
> >  		goto out;
> > -	} else if (cpumask_test_cpu(cpudl_maximum_cpu(cp), &p->cpus_allowed) &&
> > -			dl_time_before(dl_se->deadline, cpudl_maximum_dl(cp))) {
> > -		best_cpu = cpudl_maximum_cpu(cp);
> > -		if (later_mask)
> > -			cpumask_set_cpu(best_cpu, later_mask);
> > +	} else {
> > +		int max_cpu = cpudl_maximum_cpu(cp);
> > +		u64 max_dl = cpudl_maximum_dl(cp);
> > +
> > +		if (max_cpu != -1 &&
> > +		    cpumask_test_cpu(max_cpu, &p->cpus_allowed) &&
> > +		    dl_time_before(dl_se->deadline, max_dl)) {
> 
> Don't we access cp 3 times both ways?

I wonder if I miss something.. As you said, in most cases it will, but
I am not sure if we can guarentee that, regardless of arches or
compile optimization level. Sorry if I am wrong.

      reply	other threads:[~2017-06-12  1:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-02  7:31 [PATCH 1/2] sched/deadline: Add cpudl_maximum_dl() Byungchul Park
2017-06-02  7:31 ` [PATCH 2/2] sched/deadline: Don't return invalid cpu in cpudl_maximum_cpu() Byungchul Park
2017-06-06 15:12   ` Juri Lelli
2017-06-06 23:42     ` Byungchul Park
2017-06-07  0:14       ` Byungchul Park
2017-06-08 14:02         ` Juri Lelli
2017-06-09  2:43           ` Byungchul Park
2017-06-09 11:42             ` Juri Lelli
2017-06-12  1:43               ` Byungchul Park [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=20170612014307.GH3623@X58A-UD3R \
    --to=byungchul.park@lge.com \
    --cc=juri.lelli@arm.com \
    --cc=juri.lelli@gmail.com \
    --cc=kernel-team@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.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

all inboxes | Powered by JetHome®