timer.c - high load avarage with idle cpu

From: Harry Nak
Date: Wed Dec 01 2010 - 09:37:14 EST


Hi all,

I am developing an application on a at91rm9200 platform. Recently I
found out that the load average on this system is very high while the
cpu remains almost idle.
My application uses a lot of timers but the expiration of such a timer
causes almost no processing to be performed.

I think I found the reason for this load average/cpu usage
inconsistency and I (think I ) found a solution:

update_process_times() in timer.c first calls the function
run_local_timers() before calling scheduler_tick().

run_local_timers() raises TIMER_SOFTIRQ, which causes threads
associated with any expired timers to be marked RUNNABLE.
scheduler_tick() -> update_cpu_load() -> calc_load_account_active() ->
calc_load_fold_active() adds such a thread to the number of active
threads, thus causing the load average to increase. However this
particular thread never had to wait to become running and it will not
consume much cpu time.

My solution is to postpone the call to run_local_timers() until
scheduler_tick() has been called.

Could anybody confirm my theory and is it possible that my solution
breaks anything?

- Harry
--
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/