[PATCH 2/2] sched: Fix "divide error: 0000" in find_busiest_group

From: Terry Loftin
Date: Tue Jul 19 2011 - 16:58:43 EST

Add a check to sched_avg_update() to detect and reset age_stamp if the
clock value has wrapped. Because __cycles_2_ns() includes an offset
to account for start up time, the clock may not wrap to zero, so use
the current clock value instead.

Signed-off-by: Terry Loftin <terry.loftin@xxxxxx>
Signed-off-by: Bob Montgomery <bob.montgomery@xxxxxx>
diff --git a/kernel/sched.c b/kernel/sched.c
index 18d38e4..b39cae1 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1256,6 +1256,8 @@ static void sched_avg_update(struct rq *rq)
s64 period = sched_avg_period();

+ if (unlikely(rq->age_stamp > rq->clock))
+ rq->age_stamp = rq->clock;
while ((s64)(rq->clock - rq->age_stamp) > period) {
* Inline assembly required to prevent the compiler
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/