aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-01-28 08:51:40 -0500
committerIngo Molnar <mingo@elte.hu>2009-02-01 04:49:51 -0500
commita571bbeafbcc501d9989fbce1cddcd810bd51d71 (patch)
treecbfc71ece2ae3e351424d5f7ca9d8fff2429827b /kernel
parenta9f3e2b549f83a9cdab873abf4140be27c05a3f2 (diff)
sched: fix buddie group latency
Similar to the previous patch, by not clearing buddies we can select entities past their run quota, which can increase latency. This means we have to clear group buddies as well. Do not use the group clear for pick_next_task(), otherwise that'll get O(n^2). Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched_fair.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 75248b9ff4c1..a7e50ba185ac 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -719,7 +719,7 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int wakeup)
719 __enqueue_entity(cfs_rq, se); 719 __enqueue_entity(cfs_rq, se);
720} 720}
721 721
722static void clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se) 722static void __clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se)
723{ 723{
724 if (cfs_rq->last == se) 724 if (cfs_rq->last == se)
725 cfs_rq->last = NULL; 725 cfs_rq->last = NULL;
@@ -728,6 +728,12 @@ static void clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se)
728 cfs_rq->next = NULL; 728 cfs_rq->next = NULL;
729} 729}
730 730
731static void clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se)
732{
733 for_each_sched_entity(se)
734 __clear_buddies(cfs_rq_of(se), se);
735}
736
731static void 737static void
732dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int sleep) 738dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int sleep)
733{ 739{
@@ -1455,7 +1461,7 @@ static struct task_struct *pick_next_task_fair(struct rq *rq)
1455 * If se was a buddy, clear it so that it will have to earn 1461 * If se was a buddy, clear it so that it will have to earn
1456 * the favour again. 1462 * the favour again.
1457 */ 1463 */
1458 clear_buddies(cfs_rq, se); 1464 __clear_buddies(cfs_rq, se);
1459 set_next_entity(cfs_rq, se); 1465 set_next_entity(cfs_rq, se);
1460 cfs_rq = group_cfs_rq(se); 1466 cfs_rq = group_cfs_rq(se);
1461 } while (cfs_rq); 1467 } while (cfs_rq);