On Thu, 2010-05-27 at 15:06 +0100, Matthew Garrett wrote: > I don't entirely see how this works. In order to deal with poorly > written applications, it's necessary to (optionally, based on some > policy) ignore them when it comes to the scheduler. The problem is how > to implement the optional nature of this in a race-free manner. This is > obviously a pathological case, but imagine an application that does > something along the following lines: > > int input = open ("/dev/input", O_RDONLY|O_NONBLOCK); > char foo; > > while (1) { > suspend_block(); > if (read(input, &foo, 1) > 0) { > (do something) > suspend_unblock(); > } else { > suspend_unblock(); > (draw bouncing cows and clouds and tractor beams briefly) > } > } > > Now, if the user is playing this game, you want it to be scheduled. If > the user has put down their phone and the screen lock has kicked in, you > don't want it to be scheduled. So we could imagine some sort of cgroup > that contains untrusted tasks - when the session is active we set a flag > one way which indicates to the scheduler that tasks in TASK_RUNNING > should be scheduled, and when the session is idle we set the flag the > other way and all processes in that cgroup get shifted to > TASK_INTERRUPTIBLE or something. What's wrong with simply making the phone beep loudly and displaying: bouncing cows is preventing your phone from sleeping! _______________________________________________ linux-pm mailing list linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/linux-pm