From 939995e38a800cc0113cd2ffb5436024ea2aec12 Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Wed, 13 Dec 2006 00:35:45 -0800 Subject: [PATCH] --- yaml --- r: 44515 b: refs/heads/master c: cd7175edf963a92b2c3cd491d3e34afd357e7284 h: refs/heads/master i: 44513: 52b5ac58ebe79495c953baf9c75e3a800c4b9488 44511: 838b8164cb4b5e3b50fd7f517e7d8d800047dab6 v: v3 --- [refs] | 2 +- trunk/kernel/timer.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) 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); } }