summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorMike Galbraith <efault@gmx.de>2009-01-28 14:51:39 +0100
committerIngo Molnar <mingo@elte.hu>2009-02-01 10:49:50 +0100
commita9f3e2b549f83a9cdab873abf4140be27c05a3f2 (patch)
tree756fb52736f8bd1e1f8fb0a621ac58ec8e1812d3 /kernel
parent1596e29773eadd96b0a5fc6e736afa52394cafda (diff)
downloadop-kernel-dev-a9f3e2b549f83a9cdab873abf4140be27c05a3f2.zip
op-kernel-dev-a9f3e2b549f83a9cdab873abf4140be27c05a3f2.tar.gz
sched: clear buddies more aggressively
It was noticed that a task could get re-elected past its run quota due to buddy affinities. This could increase latency a little. Cure it by more aggresively clearing buddy state. We do so in two situations: - when we force preempt - when we select a buddy to run Signed-off-by: Mike Galbraith <efault@gmx.de> 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.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index fdc4175..75248b9 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -768,8 +768,14 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr)
ideal_runtime = sched_slice(cfs_rq, curr);
delta_exec = curr->sum_exec_runtime - curr->prev_sum_exec_runtime;
- if (delta_exec > ideal_runtime)
+ if (delta_exec > ideal_runtime) {
resched_task(rq_of(cfs_rq)->curr);
+ /*
+ * The current task ran long enough, ensure it doesn't get
+ * re-elected due to buddy favours.
+ */
+ clear_buddies(cfs_rq, curr);
+ }
}
static void
@@ -1445,6 +1451,11 @@ static struct task_struct *pick_next_task_fair(struct rq *rq)
do {
se = pick_next_entity(cfs_rq);
+ /*
+ * If se was a buddy, clear it so that it will have to earn
+ * the favour again.
+ */
+ clear_buddies(cfs_rq, se);
set_next_entity(cfs_rq, se);
cfs_rq = group_cfs_rq(se);
} while (cfs_rq);
OpenPOWER on IntegriCloud