[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1274970531.27810.5024.camel@twins>
Date: Thu, 27 May 2010 16:28:51 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Matthew Garrett <mjg59@...f.ucam.org>
Cc: Alan Cox <alan@...rguk.ukuu.org.uk>,
Arve Hjønnevåg <arve@...roid.com>,
Florian Mickler <florian@...kler.org>,
Vitaly Wool <vitalywool@...il.com>,
LKML <linux-kernel@...r.kernel.org>,
Paul@...p1.linux-foundation.org, felipe.balbi@...ia.com,
Linux OMAP Mailing List <linux-omap@...r.kernel.org>,
Linux PM <linux-pm@...ts.linux-foundation.org>
Subject: Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)
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!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists