Extracted from a "sched-misc-bits.patch" patch from Peter Zijlstra . This patch also moves the check_spread test where nr_running is always non-zero. Signed-off-by: Mathieu Desnoyers CC: Peter Zijlstra --- kernel/sched_fair.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) Index: linux-2.6-lttng.git/kernel/sched_fair.c =================================================================== --- linux-2.6-lttng.git.orig/kernel/sched_fair.c +++ linux-2.6-lttng.git/kernel/sched_fair.c @@ -715,7 +715,7 @@ static void check_spread(struct cfs_rq * if (d < 0) d = -d; - if (d > 3*sysctl_sched_latency) + if (d > 3*cfs_rq->nr_running*sysctl_sched_latency) schedstat_inc(cfs_rq, nr_spread_over); #endif } @@ -803,6 +803,7 @@ dequeue_entity(struct cfs_rq *cfs_rq, st * Update run-time statistics of the 'current'. */ update_curr(cfs_rq); + check_spread(cfs_rq, se); update_stats_dequeue(cfs_rq, se); if (flags & DEQUEUE_SLEEP) { @@ -932,11 +933,9 @@ static void put_prev_entity(struct cfs_r * If still on the runqueue then deactivate_task() * was not called and update_curr() has to be done: */ - if (prev->on_rq) - update_curr(cfs_rq); - - check_spread(cfs_rq, prev); if (prev->on_rq) { + update_curr(cfs_rq); + check_spread(cfs_rq, prev); update_stats_wait_start(cfs_rq, prev); /* Put 'current' back into the tree. */ __enqueue_entity(cfs_rq, prev); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/