linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* sched: remove redundant hierarchy walk in check_preempt_wakeup
@ 2009-04-08 22:29 Paul Turner
  2009-04-09  6:00 ` Peter Zijlstra
  2009-04-09  7:09 ` [tip:sched/core] " Paul Turner
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Turner @ 2009-04-08 22:29 UTC (permalink / raw)
  To: mingo, peterz, linux-kernel

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.

Thanks,

- Paul

--

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>
---
 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)
-- 
1.5.4.3

	

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: sched: remove redundant hierarchy walk in check_preempt_wakeup
  2009-04-08 22:29 sched: remove redundant hierarchy walk in check_preempt_wakeup Paul Turner
@ 2009-04-09  6:00 ` Peter Zijlstra
  2009-04-09  7:09 ` [tip:sched/core] " Paul Turner
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2009-04-09  6:00 UTC (permalink / raw)
  To: Paul Turner; +Cc: mingo, linux-kernel

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)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip:sched/core] sched: remove redundant hierarchy walk in check_preempt_wakeup
  2009-04-08 22:29 sched: remove redundant hierarchy walk in check_preempt_wakeup Paul Turner
  2009-04-09  6:00 ` Peter Zijlstra
@ 2009-04-09  7:09 ` Paul Turner
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Turner @ 2009-04-09  7:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, pjt, tglx, mingo

Commit-ID:  002f128b473fb82f454654be5081b0919ee01ab2
Gitweb:     http://git.kernel.org/tip/002f128b473fb82f454654be5081b0919ee01ab2
Author:     Paul Turner <pjt@google.com>
AuthorDate: Wed, 8 Apr 2009 15:29:43 -0700
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 9 Apr 2009 08:19:08 +0200

sched: remove redundant hierarchy walk in check_preempt_wakeup

Impact: micro-optimization

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>
LKML-Reference: <alpine.DEB.1.00.0904081520320.30317@kitami.corp.google.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 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)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-04-09  7:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-08 22:29 sched: remove redundant hierarchy walk in check_preempt_wakeup Paul Turner
2009-04-09  6:00 ` Peter Zijlstra
2009-04-09  7:09 ` [tip:sched/core] " Paul Turner

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).