Re: [PATCH 1/8] PM: Add suspend block api.

Pavel Machek
2010-05-27T15:41:52Z

Hi!

> > > > Yeah, one file selects behavior of another file, and to read available
> > > > states for opportunistic, you have to write to file first.
> > > >
> > > > I still don't like the interface.
> > > >
> > >
> > > Actually, what would be a better interface?
> > >
> > > I wonder why it is not like this:
>
> Because I think the "forced" and "opportunistic" suspend "modes" are mutually
> exclusive in practice and the interface as proposed reflects that quite well.

Why should they be? Forced disk while opportunistic mem is active
makes a lot of sense. If code can't support it now, just return
-EINVAL, but please don't cripple the interface just because of that.

> > > /sys/power/state
> > > no change, works with and without opportunistic suspend the
> > > same. Ignores suspend blockers. Really no change. (From user
> > > perspective)
> > >
> > > /sys/power/opportunistic
> > > On / Off
> > > While Off the opportunistic suspend is off.
> > > While On, the opportunistic suspend is on and if there are no
> > > suspend blockers the system goes to suspend.
> > >
> >
> > I forgot, of course there needs to be another knob to implement the
> > "on" behaviour in the opportunistic mode
> >
> > /sys/power/block_opportunistic_suspend
> >
> > There you have it. One file, one purpose.
>
> That's getting messy IMHO.
>
> In addition to that you get a nice race when the user writes "mem"
> to /sys/power/state and opportunistic suspend happens at the same
> time.

It should not opportunistically suspend when it has work to do (like
entering forced suspend).
Pavel

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html