Re: [RFC][PATCH] sched: Optimize cgroup pick_next_task_fair
From: Mike Galbraith
Date: Sat Feb 11 2012 - 01:57:06 EST
On Sat, 2012-02-11 at 06:05 +0100, Peter Zijlstra wrote:
> Since commit 2f36825b1 ("sched: Next buddy hint on sleep and preempt
> path") it is likely we pick a new task from the same cgroup, doing a put
> and then set on all intermediate entities is a waste of time, so try to
> avoid this.
Good idea, we need to lose some weight.
> XXX check put_prev_task()'s update_rq_clock() magic..
I made that even more lovable ;-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index d7c4322..7c1cfa6 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3175,6 +3175,7 @@ need_resched:
} else {
deactivate_task(rq, prev, DEQUEUE_SLEEP);
prev->on_rq = 0;
+ rq->skip_clock_update = 1;
/*
* If a worker went to sleep, notify and ask workqueue
@@ -3200,9 +3201,9 @@ need_resched:
put_prev_task(rq, prev);
next = pick_next_task(rq);
clear_tsk_need_resched(prev);
- rq->skip_clock_update = 0;
if (likely(prev != next)) {
+ rq->skip_clock_update = 0;
rq->nr_switches++;
rq->curr = next;
++*switch_count;
@@ -3220,6 +3221,7 @@ need_resched:
raw_spin_unlock_irq(&rq->lock);
post_schedule(rq);
+ rq->skip_clock_update = 0;
preempt_enable_no_resched();
if (need_resched())
> Compile tested only.. inspired by pjt's fast switch stories.
I was looking forward to seeing those fast switch patches, nice spot to
cut lard.
> Not-quite-signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
I'll see if I can give it some runtime.
-Mike
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/