The key need isn't to 'allow "important" processes to keep the device awake' but rather to 'allow "important" *events* to keep the device awake'. So the proposed scheme would require tying events to processes and require blocking access to event generators. i.e. it would preclude a non-blocking programming style where a main loop uses e.g. poll() to be alerted to new events and handled then as required.
In any case, I thought that this problem was solved, it is just that no-one is using the solution. See /sys/power/wakeup_count and the documentation in kernel/power/main.c.
The opportunistic-suspend user-space program does:
- read /sys/power/wakeup_count
- check that the rest of user-space is ready to suspend.
- write the value read back into /sys/power/wakeup_count
- if that succeeds, write 'sleep' to /sys/power/state
- wait for user-space to be quiescent again
- go back to the top of the loop.
Is this not sufficient?
Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds