aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/timer.c')
-rw-r--r--kernel/timer.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/kernel/timer.c b/kernel/timer.c
index a2cb1ecb1b28..4f55622b0d38 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1222,10 +1222,8 @@ static inline void calc_load(unsigned long ticks)
1222 unsigned long active_tasks; /* fixed-point */ 1222 unsigned long active_tasks; /* fixed-point */
1223 static int count = LOAD_FREQ; 1223 static int count = LOAD_FREQ;
1224 1224
1225 count -= ticks; 1225 active_tasks = count_active_tasks();
1226 if (count < 0) { 1226 for (count -= ticks; count < 0; count += LOAD_FREQ) {
1227 count += LOAD_FREQ;
1228 active_tasks = count_active_tasks();
1229 CALC_LOAD(avenrun[0], EXP_1, active_tasks); 1227 CALC_LOAD(avenrun[0], EXP_1, active_tasks);
1230 CALC_LOAD(avenrun[1], EXP_5, active_tasks); 1228 CALC_LOAD(avenrun[1], EXP_5, active_tasks);
1231 CALC_LOAD(avenrun[2], EXP_15, active_tasks); 1229 CALC_LOAD(avenrun[2], EXP_15, active_tasks);
@@ -1270,11 +1268,8 @@ void run_local_timers(void)
1270 * Called by the timer interrupt. xtime_lock must already be taken 1268 * Called by the timer interrupt. xtime_lock must already be taken
1271 * by the timer IRQ! 1269 * by the timer IRQ!
1272 */ 1270 */
1273static inline void update_times(void) 1271static inline void update_times(unsigned long ticks)
1274{ 1272{
1275 unsigned long ticks;
1276
1277 ticks = jiffies - wall_jiffies;
1278 wall_jiffies += ticks; 1273 wall_jiffies += ticks;
1279 update_wall_time(); 1274 update_wall_time();
1280 calc_load(ticks); 1275 calc_load(ticks);
@@ -1286,12 +1281,10 @@ static inline void update_times(void)
1286 * jiffies is defined in the linker script... 1281 * jiffies is defined in the linker script...
1287 */ 1282 */
1288 1283
1289void do_timer(struct pt_regs *regs) 1284void do_timer(unsigned long ticks)
1290{ 1285{
1291 jiffies_64++; 1286 jiffies_64 += ticks;
1292 /* prevent loading jiffies before storing new jiffies_64 value. */ 1287 update_times(ticks);
1293 barrier();
1294 update_times();
1295} 1288}
1296 1289
1297#ifdef __ARCH_WANT_SYS_ALARM 1290#ifdef __ARCH_WANT_SYS_ALARM