aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched_fair.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2008-10-24 05:06:16 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-24 06:51:03 -0400
commit3f3a490480d8ab96e0fe30a41f80f14e6a0c579d (patch)
treeaddbfb1207d816b1e1f5e4ab75f95a08c7b15202 /kernel/sched_fair.c
parent464b75273f64be7c81fee975bd6ca9593df3427b (diff)
sched: virtual time buddy preemption
Since we moved wakeup preemption back to virtual time, it makes sense to move the buddy stuff back as well. The purpose of the buddy scheduling is to allow a quickly scheduling pair of tasks to run away from the group as far as a regular busy task would be allowed under wakeup preemption. This has the advantage that the pair can ping-pong for a while, enjoying cache-hotness. Without buddy scheduling other tasks would interleave destroying the cache. Also, it saves a word in cfs_rq. 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>
Diffstat (limited to 'kernel/sched_fair.c')
-rw-r--r--kernel/sched_fair.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 7af17e04a6db..ce514afd78ff 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -791,16 +791,14 @@ set_next_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
791 se->prev_sum_exec_runtime = se->sum_exec_runtime; 791 se->prev_sum_exec_runtime = se->sum_exec_runtime;
792} 792}
793 793
794static int
795wakeup_preempt_entity(struct sched_entity *curr, struct sched_entity *se);
796
794static struct sched_entity * 797static struct sched_entity *
795pick_next(struct cfs_rq *cfs_rq, struct sched_entity *se) 798pick_next(struct cfs_rq *cfs_rq, struct sched_entity *se)
796{ 799{
797 struct rq *rq = rq_of(cfs_rq); 800 if (!cfs_rq->next || wakeup_preempt_entity(cfs_rq->next, se) == 1)
798 u64 pair_slice = rq->clock - cfs_rq->pair_start;
799
800 if (!cfs_rq->next || pair_slice > sysctl_sched_min_granularity) {
801 cfs_rq->pair_start = rq->clock;
802 return se; 801 return se;
803 }
804 802
805 return cfs_rq->next; 803 return cfs_rq->next;
806} 804}