mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Qais Yousef <qais.yousef@arm.com>
Cc: Peng Liu <iwtbavbm@gmail.com>,
	linux-kernel@vger.kernel.org, mingo@redhat.com
Subject: Re: [PATCH] sched/fair: eliminate redundant code in sched_slice()
Date: Wed, 21 Aug 2019 20:37:13 +0200	[thread overview]
Message-ID: <20190821183713.GF2349@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20190821151523.lwazjd2d6rp5otdh@e107158-lin.cambridge.arm.com>

On Wed, Aug 21, 2019 at 04:15:24PM +0100, Qais Yousef wrote:
> On 08/16/19 22:12, Peng Liu wrote:
> > Since sched_slice() is used in high frequency,
> > small change should also make sense.
> > 
> > Signed-off-by: Peng Liu <iwtbavbm@gmail.com>
> > ---
> >  kernel/sched/fair.c | 11 ++++-------
> >  1 file changed, 4 insertions(+), 7 deletions(-)
> > 
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 1054d2cf6aaa..6ae2a507aac0 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -694,19 +694,16 @@ static u64 sched_slice(struct cfs_rq *cfs_rq, struct sched_entity *se)
> >  	u64 slice = __sched_period(cfs_rq->nr_running + !se->on_rq);
> >  
> >  	for_each_sched_entity(se) {
> > -		struct load_weight *load;
> >  		struct load_weight lw;
> >  
> >  		cfs_rq = cfs_rq_of(se);
> > -		load = &cfs_rq->load;
> > +		lw = cfs_rq->load;
> >  
> > -		if (unlikely(!se->on_rq)) {
> > +		if (unlikely(!se->on_rq))
> >  			lw = cfs_rq->load;
> >  
> > -			update_load_add(&lw, se->load.weight);
> > -			load = &lw;
> > -		}
> > -		slice = __calc_delta(slice, se->load.weight, load);
> > +		update_load_add(&lw, se->load.weight);
> > +		slice = __calc_delta(slice, se->load.weight, &lw);
> 
> Unless I misread the diff, you changed the behavior.
> 
> update_load_add() is only called if (unlikely(!se->on_rq)), but with your
> change it is called unconditionally. And lw is set twice.
> 
> I think what you intended is this?

So I'd really rather hold off on this; Rik is poking at getting rid of
all of this hierarchical crud in one go.

      reply	other threads:[~2019-08-21 18:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-16 14:12 Peng Liu
2019-08-20 13:50 ` Peter Zijlstra
2019-08-21 11:20   ` Peng Liu
2019-08-21 15:15 ` Qais Yousef
2019-08-21 18:37   ` 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=20190821183713.GF2349@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=iwtbavbm@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=qais.yousef@arm.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

Powered by JetHome