sched: remove redundant hierarchy walk in check_preempt_wakeup
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.
--- kernel/sched_fair.c | 13 +++---------- 1 files changed, 3 insertions(+), 10 deletions(-)
kernel/sched_fair.c +3 -10
@@ -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)
Signature · 1 line
1.5.4.3
Peter Zijlstra
Acked-byQuoted 7 lines · Paul Turner
Hi Ingo, Peter,
In
check_preempt_wakeupwe walk up until both entities are queued on the samecfs_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.
Quoted 11 lines
--
sched: remove redundant hierarchy walk in
check_preempt_wakeupUnder 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 <[email protected]>
Quoted 29 lines
--- kernel/sched_fair.c | 13 +++---------- 1 files changed, 3 insertions(+), 10 deletions(-)kernel/sched_fair.c +3
-10@@ -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)
Commit-ID: 002f128b473fb82f454654be5081b0919ee01ab2 Gitweb: http://git.kernel.org/tip/002f128b473fb82f454654be5081b0919ee01ab2 Author: Paul Turner <[email protected]> AuthorDate: Wed, 8 Apr 2009 15:29:43 -0700 Committer: Ingo Molnar <[email protected]> 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.
LKML-Reference: <[email protected]>
--- kernel/sched_fair.c | 13 +++---------- 1 files changed, 3 insertions(+), 10 deletions(-)
kernel/sched_fair.c +3 -10
@@ -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)