timeouts (VST) patch
The Linux kernel tries to save power by, among other things, halting the
processor when there is no work to be done. The processor's sleep can be
fitful, however; even when there is no work, the timer interrupt will
continue to wake the processor every 1/1000 to 1/100 second.
George Anzinger's new
seeks to solve this problem by eliminating timer
interrupts when there is nothing for that interrupt to do.
The kernel timer interrupt is responsible for keeping track of time for
the kernel by updating the value of jiffies and handling other
housekeeping and process accounting functions.
When processing the timer interrupt, the kernel will periodically also check
the timer list to see if any kernel timers have expired and if so, call
the completion function for that timer. Timers in the kernel are one of
the mechanisms used to schedule work that needs to be done in the future.
In the absence of a running process, the only real work that needs to be
done in the timer interrupt is the maintenance of the timer list.
When no processes are running,
the VST patch causes the idle task to scan the timer list and delay the
timer interrupt if there are no timers that will expire in the next timer
tick. It does this by changing the value in the Programmable Interrupt
Timer (PIT) to generate an interrupt when the next timer is set to
expire. The resolution of the PIT only allows values up to about 50ms
and thus that is currently the limit of how long a timer interrupt can be
held off, but
there are plans to use the Real Time Clock hardware in the future
to remove this restriction. When the timer interrupt eventually occurs,
the VST code will update jiffies and do the necessary housekeeping
to handle the amount of time that has been missed.
If the system is idle, there are no runnable tasks currently active, but
an interrupt from the hardware could change that situation. To handle this
case, the VST patch
hooks into the low-level interrupt handling code to re-enable the timer
interrupt when another interrupt occurs. It also runs the timer interrupt
at that time to update the kernel time information
as if the timer interrupts had occurred normally.
The benefit of this patch is that when the system is idle
the kernel can halt the processor in order to
conserve power. Eliminating needless timer interrupts help to keep the
processor idle longer.
The result is that battery operated Linux based devices
can operate longer on a single charge, which should make PDA and laptop
users happier. As of this writing, there are no hard numbers on how
well this patch reduces power consumption, hopefully some information on
that will be forthcoming.
to post comments)