mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Paul Turner <pjt@google.com>
Cc: mingo@elte.hu, linux-kernel@vger.kernel.org
Subject: Re: sched: remove redundant hierarchy walk in check_preempt_wakeup
Date: Thu, 09 Apr 2009 08:00:53 +0200	[thread overview]
Message-ID: <1239256853.13185.1131.camel@twins> (raw)
In-Reply-To: <alpine.DEB.1.00.0904081520320.30317@kitami.corp.google.com>

On Wed, 2009-04-08 at 15:29 -0700, Paul Turner wrote:
> Hi Ingo, Peter,
> 
> In check_preempt_wakeup we walk up until both entities are queued on the
> same cfs_rq.  After the iteration of vruntime vs wall-clock pre-emption 
> changes the current check now checks at every level of the tree above 
> this.  However, unless I'm missing something at this point they should
> have a common parent.

Yes, you're right, and them having a common parent means the rest of the
preemption checks will be against itself.

> --
> 
> sched: remove redundant hierarchy walk in check_preempt_wakeup
> 
> Under group scheduling we traverse up until we are at common siblings to make
> the wakeup comparison on.
> 
> At this point however, they should have the same parent so continuing to check
> up the tree is redundant.
> 
> Signed-off-by: Paul Turner <pjt@google.com>

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>

> ---
>  kernel/sched_fair.c |   13 +++----------
>  1 files changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
> index 3816f21..5f9650e 100644
> --- a/kernel/sched_fair.c
> +++ b/kernel/sched_fair.c
> @@ -1487,17 +1487,10 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int sync)
>  
>  	find_matching_se(&se, &pse);
>  
> -	while (se) {
> -		BUG_ON(!pse);
> +	BUG_ON(!pse);
>  
> -		if (wakeup_preempt_entity(se, pse) == 1) {
> -			resched_task(curr);
> -			break;
> -		}
> -
> -		se = parent_entity(se);
> -		pse = parent_entity(pse);
> -	}
> +	if (wakeup_preempt_entity(se, pse) == 1)
> +		resched_task(curr);
>  }
>  
>  static struct task_struct *pick_next_task_fair(struct rq *rq)

  reply	other threads:[~2009-04-09  5:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-08 22:29 Paul Turner
2009-04-09  6:00 ` Peter Zijlstra [this message]
2009-04-09  7:09 ` [tip:sched/core] " Paul Turner

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=1239256853.13185.1131.camel@twins \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=pjt@google.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®