By Jonathan Corbet
April 14, 2010
When Google's Mike Waychison
addressed the 2009 Kernel
Summit, one of the goals he laid out was the merging of Google's idle
cycle injection code into the mainline. Idle cycle injection is the forced
idling of the CPU to avoid overheating; essentially, it is Google's way of
running processors to the very edge of their capability without going
past that edge and allowing the smoke to escape. This sort of power
management is
certainly not a Google-specific problem, so it makes sense to get the code
upstream. Salman Qazi's recently posted
kidled patch series shows the
current form of this work.
The core idea is simple: through some new control files under
/proc/sys/kernel/kidled, the system administrator can set, on a
per-CPU basis, the percentage of time that the CPU should be idle and an
interval over which that percentage is calculated. If the end of an
interval draws near and the CPU has not been naturally idle for the
requisite time, kidled will force the processor to go idle for a while.
Naturally enough, there are some complications. The first is that it would
be nice to avoid forcing idle cycles when important processes are running.
So kidled includes the notion of "eager cycle injection." By way of the
control group mechanism, processes can be marked as being "interactive."
When so-marked processes are not running, kidled will try to get its
forced idle cycles in early. When interactive processes are
running, instead, idle cycles will be forced only when strictly necessary.
In this way, "interactive" processes will not be impeded by idle cycle
injection except when there is no alternative.
The other twist has to do with the accounting of idle CPU time. The
injection of idle cycles takes CPU time away from somebody; the kidled code
allows the administrator to say who the victims should be. There is
another control group parameter which controls the "power capping
priority" of each process. When idle cycles are injected, kidled will mess
around in the scheduler's data structures, causing processes with lower
priorities to be charged for the idle time. That means that, when CPU
usage must be throttled, specific processes can be made to suffer more than
others.
As of this writing, there has been little public discussion of the
patches. The core concept is not controversial, but it will be interesting to
see how the scheduler-related parts of the series are received.
(
Log in to post comments)