diff --git a/[refs] b/[refs] index 6e5e73420f6b..bf1c328b8e46 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f988443a84528bd30c2f474efa5e2c511959f19b +refs/heads/master: cd7175edf963a92b2c3cd491d3e34afd357e7284 diff --git a/trunk/kernel/timer.c b/trunk/kernel/timer.c index 0256ab443d8a..feddf817baa5 100644 --- a/trunk/kernel/timer.c +++ b/trunk/kernel/timer.c @@ -1146,11 +1146,15 @@ static inline void calc_load(unsigned long ticks) unsigned long active_tasks; /* fixed-point */ static int count = LOAD_FREQ; - active_tasks = count_active_tasks(); - for (count -= ticks; count < 0; count += LOAD_FREQ) { - CALC_LOAD(avenrun[0], EXP_1, active_tasks); - CALC_LOAD(avenrun[1], EXP_5, active_tasks); - CALC_LOAD(avenrun[2], EXP_15, active_tasks); + count -= ticks; + if (unlikely(count < 0)) { + active_tasks = count_active_tasks(); + do { + CALC_LOAD(avenrun[0], EXP_1, active_tasks); + CALC_LOAD(avenrun[1], EXP_5, active_tasks); + CALC_LOAD(avenrun[2], EXP_15, active_tasks); + count += LOAD_FREQ; + } while (count < 0); } }