aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched_fair.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2009-09-16 06:31:31 -0400
committerIngo Molnar <mingo@elte.hu>2009-09-17 04:17:25 -0400
commitad4b78bbcbab66998b05d422ac6106b645796e54 (patch)
tree45f3561f4bd6b886948a3b0eea64edab9bab9eda /kernel/sched_fair.c
parenteb24073bc1fe3e569a855cf38d529fb650c35524 (diff)
sched: Add new wakeup preemption mode: WAKEUP_RUNNING
Create a new wakeup preemption mode, preempt towards tasks that run shorter on avg. It sets next buddy to be sure we actually run the task we preempted for. Test results: root@twins:~# while :; do :; done & [1] 6537 root@twins:~# while :; do :; done & [2] 6538 root@twins:~# while :; do :; done & [3] 6539 root@twins:~# while :; do :; done & [4] 6540 root@twins:/home/peter# ./latt -c4 sleep 4 Entries: 48 (clients=4) Averages: ------------------------------ Max 4750 usec Avg 497 usec Stdev 737 usec root@twins:/home/peter# echo WAKEUP_RUNNING > /debug/sched_features root@twins:/home/peter# ./latt -c4 sleep 4 Entries: 48 (clients=4) Averages: ------------------------------ Max 14 usec Avg 5 usec Stdev 3 usec Disabled by default - needs more testing. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Acked-by: Mike Galbraith <efault@gmx.de> Signed-off-by: Ingo Molnar <mingo@elte.hu> LKML-Reference: <new-submission>
Diffstat (limited to 'kernel/sched_fair.c')
-rw-r--r--kernel/sched_fair.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index c741cd9d38de..3e6f78c66876 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1605,9 +1605,6 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
1605 return; 1605 return;
1606 } 1606 }
1607 1607
1608 if (!sched_feat(WAKEUP_PREEMPT))
1609 return;
1610
1611 if ((sched_feat(WAKEUP_SYNC) && sync) || 1608 if ((sched_feat(WAKEUP_SYNC) && sync) ||
1612 (sched_feat(WAKEUP_OVERLAP) && 1609 (sched_feat(WAKEUP_OVERLAP) &&
1613 (se->avg_overlap < sysctl_sched_migration_cost && 1610 (se->avg_overlap < sysctl_sched_migration_cost &&
@@ -1616,6 +1613,17 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
1616 return; 1613 return;
1617 } 1614 }
1618 1615
1616 if (sched_feat(WAKEUP_RUNNING)) {
1617 if (pse->avg_running < se->avg_running) {
1618 set_next_buddy(pse);
1619 resched_task(curr);
1620 return;
1621 }
1622 }
1623
1624 if (!sched_feat(WAKEUP_PREEMPT))
1625 return;
1626
1619 find_matching_se(&se, &pse); 1627 find_matching_se(&se, &pse);
1620 1628
1621 BUG_ON(!pse); 1629 BUG_ON(!pse);