Often the 'sleep trigger' is an _absence_ of activity rather than anything
explicit like a button being pressed. You need inactivity timers, and events
which _reset_ those timers, on triggers like keyboard/touchscreen/serial
input, etc.
It's arguable that you can do that in userspace. Possibly - I'm not 100%
convinced of that. If you have many events which can reset many different
timers, the amount of traffic between kernel and user space just to reset
those timers may be quite high.
If an inactivity timer is implemented in userspace, with serial input being
one of the events that resets it, you're going to get a lot of wakeup/reset
events if you do a large download over that port.
It's possible that we could optimise that somehow, so we can avoid having
to implement PM timers in kernelspace. I'm not sure. Perhaps the wakeup
events could be on a separate queue, with no duplicates permitted, and the
PM daemon could poll that queue only when it's about to shoot one of its
timers.
For maximum efficiency, when receiving an event in sleep mode which isn't
supposed to wake the system, we should drop the event and go back to sleep
as quickly as possible. If you have to run userspace processes to make that
decision, it's not going to be particularly fast.
It may be sensible to have a simple policy engine in the kernel which
implement a policy provided by userspace. Some kind of simple state machine.
-- dwmw2
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/