diff options
-rw-r--r-- | kernel/timer.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/kernel/timer.c b/kernel/timer.c index 0256ab443d8a..feddf817baa5 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -1146,11 +1146,15 @@ static inline void calc_load(unsigned long ticks) | |||
1146 | unsigned long active_tasks; /* fixed-point */ | 1146 | unsigned long active_tasks; /* fixed-point */ |
1147 | static int count = LOAD_FREQ; | 1147 | static int count = LOAD_FREQ; |
1148 | 1148 | ||
1149 | active_tasks = count_active_tasks(); | 1149 | count -= ticks; |
1150 | for (count -= ticks; count < 0; count += LOAD_FREQ) { | 1150 | if (unlikely(count < 0)) { |
1151 | CALC_LOAD(avenrun[0], EXP_1, active_tasks); | 1151 | active_tasks = count_active_tasks(); |
1152 | CALC_LOAD(avenrun[1], EXP_5, active_tasks); | 1152 | do { |
1153 | CALC_LOAD(avenrun[2], EXP_15, active_tasks); | 1153 | CALC_LOAD(avenrun[0], EXP_1, active_tasks); |
1154 | CALC_LOAD(avenrun[1], EXP_5, active_tasks); | ||
1155 | CALC_LOAD(avenrun[2], EXP_15, active_tasks); | ||
1156 | count += LOAD_FREQ; | ||
1157 | } while (count < 0); | ||
1154 | } | 1158 | } |
1155 | } | 1159 | } |
1156 | 1160 | ||