Re: [RFC][PATCH 2/2] PM / Sleep: Introduce cooperativesuspend/hibernate mode

From: NeilBrown
Date: Mon Oct 17 2011 - 19:14:49 EST


On Mon, 17 Oct 2011 14:43:21 -0700 John Stultz <john.stultz@xxxxxxxxxx> wrote:

> On Tue, 2011-10-18 at 08:19 +1100, NeilBrown wrote:
> > On Mon, 17 Oct 2011 12:08:49 -0700 John Stultz <john.stultz@xxxxxxxxxx> wrote:

> > > Though I also think proposed userland implementations that require
> > > communication with all wakeup consumers before suspending (which really,
> > > once you get aggressive about suspending when you can, means
> > > communicating with all wakeup consumers on every wakeup event) isn't
> > > really a good solution either.
> >
> > I would help me a lot if you could be more specific than "good". Do you mean
> > "efficient" or "simple" or "secure" or ...
>
> Sorry. Efficient is what I mean. Having every task that consumes wakeup
> events to have to be scheduled seems like it would unnecessarily slow
> the suspend process.
>
> Although I also don't see how the "its ok to suspend" handshake would
> look like from the application's point of view. If the application is
> blocking in the kernel on something, I don't think it could respond. So
> this would require either signals from the PM demaon or the app to be
> sure not to block. It just seems messy. I could just be not getting
> something that makes it more elegant, so forgive me if that's the case.
>
>

Sorry - missed this bit in the previous reply.

Blocking in the kernel would be a problem.
But programs that need to respond to events tend to avoid blocking.
They usually use an event loop and non-blocking IO, or they use threads so
that some part is always ready to respond.

The same requirements would be imposed on a process that responds to wakeup
events - it just has to be able to respond to 'about to suspend' events too.

So I don't think it is any more messy then event handling always is (and if
you use libevent, most of that is hidden under the carpet anyway).


(and no: not signals. Never signals. Just don't even think about signals.
I hate signals. Use poll or equivalents - never signals (unless you cannot
avoid them))

NeilBrown

Attachment: signature.asc
Description: PGP signature