On Thu, May 27, 2010 at 07:48:40PM +0100, Alan Cox wrote:
It's code that's broadly identical to what I posted. The screen will
come on if the event is critical, won't otherwise.
Even if it's using poll, it could block purely on the display if X turns
the screen off between poll() waking and the write being made.
If it's blocked on the write then it only starts processing the packet
again if the screen wakes up. You need to power up every piece of
hardware that an application's blocked on, just in case they need to
complete that read or write in order to get back to the event loop where
they have the opportunity to read the network packet.
So, yes, I think this can work in that case. But it doesn't work in
others - you won't idle applications that aren't accessing hardware
drivers.
As an aside, I think this is a good idea in any case since a fringe
benefit is the removal of the requirement to use the process freezer in
suspend to RAM...
The problem is determining how to constrain it to go idle, where "idle"
is defined as "Doesn't wake up until a wakeup event is received". It's
acceptable for something to use as much CPU as it wants when the user is
actively interacting with the device, but in most cases processes
shouldn't be permitted to use any CPU when the session is idle. The
question is how to implement something that allows a CPU-guzzling
application to be idled without impairing its ability to process wakeup
events.
--
Matthew Garrett | mjg59@srcf.ucam.org
--