[Pm-utils] Re: Better integration with power management scripts

Rafael J. Wysocki rjw at sisk.pl
Fri Apr 28 10:56:01 PDT 2006


Hi,

On Friday 28 April 2006 02:49, Nigel Cunningham wrote:
> On Friday 28 April 2006 08:01, Holger Macht wrote:
> > On Fri 28. Apr - 07:58:11, Nigel Cunningham wrote:
> > > On Friday 28 April 2006 07:34, Holger Macht wrote:
> > > > On Thu 27. Apr - 22:23:13, Richard Hughes wrote:
> > > > > On Thu, 2006-04-27 at 17:15 -0400, David Zeuthen wrote:
> > > > > > hughsie, pjones, mjg59: Are you guys opposed to having a notifier
> > > > > > interface?
> > > > >
> > > > > No, but i don't think it will ever be used. mjg59 was bang on when he
> > > > > said that 99% of the time spent suspending is kernel side, and if
> > > > > anything is going to go *boom* then it will be that.
> > > >
> > > > Not anymore. Since 2.6.17-rc1, where uswsusp came in, at least half is
> > > > done in userspace.
> > >
> > > That's not right.
> > >
> > > The real work, where things would go boom, is still done in the kernel
> > > (the atomic copy, bulk of the image preparation and writing the pages so
> > > on). The userspace program just contains the controlling logic and some
> > > code to possibly compress and/or encrypt the pages before handing them
> > > back to the kernel.

It also saves the image (using write() though), so it has to take care.  I'd
say it does 50% of the job as far as the responsibility is concerned.

> > Of course, I just wanted to make clear that it's definitely not 99%, and
> > also not 90%.
> 
> It would be interesting to see how much time is actually spent in userspace. I 
> suspect it would be more like 90% than 50%.

Nope.  Actually it depends on the system and the image size, but may be
like 50/50 (including the syncing of filesystems, freezing processes,
shrinking memory - that may take time, eg. if you set image_size = 0
on a 1.5 GB box).

> That said, I just managed to give uswsusp a try, and I'm quite impressed
> with Rafael's work.

Thanks a lot, although I must say it's also Pavel's work and Stefan Seyfried's,
and other contributors' too. :-)

> Even though I still disagree that putting the code in userspace is the right
> thing to do,

There are some short-term benefits.  For example, we are able to use the RSA
for encryption and we support suspend-to-disk-and-RAM on some machines
with the ability to reinitialize the graphics card if necessary.

> I'm beginning to think in terms of the question "What does 
> uswsusp need to add before Suspend2 can go away?" I guess the answer is
> that swsusp is catching up in the guts of the functionality (from my pov,
> admittedly). The main improvements I'd still like to see are the things like
> the ability to cancel the cycle,

I'm going to implement the ability to cancel the suspend (ie. cancel the image
saving).  That should be easy in the user space. ;-)

> a nicer interface,

Hm, could you please elaborate?

> the ability to use an ordinary file instead of swap

Yes.  I've been thinking about this recently and I'm going to implement it
at some time in the future.  Swap files are a different story, though.

> and support for some of the less commonly used options  
> (keeping the image, scripting support and so on).

If we support regular files, keeping the image will be easy, I think.
Scripting - well ...

> Maybe it won't be long until Suspend2 is history.

I think you're exaggerating a bit. ;-)

> Making Rafael the maintainer would be a good step too :)

Well, thanks, but I don't think it's a good idea. :-)

Greetings,
Rafael


More information about the Pm-utils mailing list