From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: nigel@tuxonice.net
Cc: linux-pm@lists.linux-foundation.org,
tuxonice-devel@lists.tuxonice.net, linux-kernel@vger.kernel.org,
Pavel Machek <pavel@ucw.cz>
Subject: Re: [TuxOnIce-devel] [RFC] TuxOnIce
Date: Wed, 27 May 2009 00:27:41 +0200 [thread overview]
Message-ID: <200905270027.41898.rjw@sisk.pl> (raw)
In-Reply-To: <1243298374.16743.161.camel@nigel-laptop>
On Tuesday 26 May 2009, Nigel Cunningham wrote:
> Hi.
>
> On Tue, 2009-05-26 at 00:39 +0200, Rafael J. Wysocki wrote:
> > [Restored CCs.]
>
> Oh, sorry.
>
> > On Monday 25 May 2009, Nigel Cunningham wrote:
> > > Hi.
> > >
> > > On Mon, 2009-05-25 at 23:43 +0200, Rafael J. Wysocki wrote:
> > > > On Monday 25 May 2009, Nigel Cunningham wrote:
> > > > > On Sat, 2009-05-09 at 01:43 +0200, Rafael J. Wysocki wrote:
> > > > > > > On Sat, 2009-05-09 at 00:46 +0200, Rafael J. Wysocki wrote:
> > > > > > > > On Friday 08 May 2009, Nigel Cunningham wrote:
> > > > > > > > > On Fri, 2009-05-08 at 16:11 +0200, Rafael J. Wysocki wrote:
> > > > > > > > > > On Friday 08 May 2009, Nigel Cunningham wrote:
> > > > > > > > > And the code includes some fundamental differences. I freeze processes
> > > > > > > > > and prepare the whole image before saving anything or doing an atomic
> > > > > > > > > copy whereas you just free memory before doing the atomic copy. You save
> > > > > > > > > everything in one part whereas I save the image in two parts.
> > > > > > > >
> > > > > > > > IMO the differences are not that fundamental. The whole problem boils down
> > > > > > > > to using the same data structures for memory management and I think we can
> > > > > > > > reach an agreement here.
> > > > > > >
> > > > > > > I think we might be able to agree on using the same data structures, but
> > > > > > > I'm not so sure about algorithms - I think you're underestimating the
> > > > > > > differences here.
> > > > > >
> > > > > > Well, which algorithms do you have in mind in particular?
> > > > >
> > > > > Sorry for the slow reply - just starting to catch up after time away.
> > > >
> > > > NP
> > > >
> > > > > The main difference is the order of doing things. TuxOnIce prepares the
> > > > > image after freezing processes and before the atomic copy. It doesn't
> > > > > just do that so that it can store a complete image of memory. It also
> > > > > does it because once processes are frozen, the only thing that's going
> > > > > to allocate storage is TuxOnIce,
> > > >
> > > > This is quite strong statement. Is it provable?
> > >
> > > Yes - just account for memory carefully. Check that everything that gets
> > > allocated by hibernation code (or code it calls) gets freed and compare
> > > the amount of memory free at the start of a cycle with the amount at the
> > > end. I haven't done it for a while, but it was perfectly doable.
> >
> > Well, this really doesn't answer my question.
> >
> > What you're saying is basically "we can verify experimentally that in the
> > majority of cases the statement holds", but I doesn't really mean "it always
> > holds", which I'd like to be sure of.
>
> Well, we can never be sure that it always holds or will always hold,
> because we're playing on a constantly changing pitch.
Exactly.
> > So, in fact, we'll need to think about safeguards that may be necessary in case
> > it doesn't hold in some strange, presumably very rare and very improbable
> > situation.
> >
> > Assume for a while that there is a situation in which something other than
> > us is allocating storage during hibernation. How can we protect ourselves from
> > that?
>
> The possibilities I see are:
>
> 1) Assume we can't know exactly how much but can allow a ball-park
> figure (current method)
> 2) Implement a means by which components that might allocate memory can
> tell us how much they might allocate (currently used internally by
> tuxonice - part of the modular design). I'd love to see this for the
> drivers' suspend code.
The drivers' suspend code is too late, we need to know that before the drivers'
suspend callbacks are run.
> > > > > and the only things that are going to allocate RAM are TuxOnIce and the
> > > > > drivers' suspend routines.
> > > >
> > > > Hmm. What about kernel threads that are not frozen?
> > >
> > > As I said above, I haven't done it for a while, but when I did, they did
> > > not seem to allocate any memory - at least not for any significant
> > > period of time. Even if they do, small amounts can also be covered by
> > > the allowance for memory for drivers' suspend routines.
> >
> > I don't think experimental verification is really sufficient in this case too.
> >
> > Either we're sure that something is impossible, in which case we need to know
> > exactly why it is impossible, or we aren't, in which case we should do
> > something to protect ourselves in case it _does_ happen after all.
>
> I agree - that's the extra pages allowance. We need to think also about
> the consequences if our assumptions aren't met: retry / abort etc (not
> oops!)
>
> > > > > The drivers' routines are pretty consistent - once you've seen how much is
> > > > > used for one invocation, you can add a small margin and call that the
> > > > > allowance to use for all future invocations. The amount of memory used
> > > > > by the hibernation code is also entirely predictable - once you know the
> > > > > characteristics of the system as it stands (ie with processes frozen),
> > > > > you know how much you're going to need for the atomic copy and for doing
> > > > > I/O. If you find that something is too big, all you need to do is thaw
> > > > > kernel threads and free some memory until you fit within constraints or
> > > > > (heaven forbid!) find that you're not getting anyway and so want to give
> > > > > up on hibernating all together.
> > > > >
> > > > > If, on the other hand, you do the drivers suspend etc and then look to
> > > > > see what state you're in, well you might need to thaw drivers etc in
> > > > > order to free memory before trying again. It's more expensive. Right now
> > > > > you're just giving up in that case - yes, you could retry too instead of
> > > > > giving up completely, but it's better IMHO to seek to get things right
> > > > > before suspending drivers.
> > > > >
> > > > > Oh, before I forget to mention and you ask - how to know what allowance
> > > > > for the drivers? I use a sysfs entry - the user then just needs to see
> > > > > what's needed on their first attempt, set up a means of putting that
> > > > > value in the sysfs file in future (eg /etc/hibernate/tuxonice.conf) and
> > > > > then forget about it.
> > > >
> > > > OK, this is reasonable.
> > > >
> > > > Still, I think your approach is based on some assumptions that need to be
> > > > verified, so that either we are 100% sure they are satisfied, or we have some
> > > > safeguards in place in case they aren't.
> > >
> > > Well, the 'extra pages allowance' as I call the memory for drivers'
> > > suspend routines is the safeguard. I'll see if I can find some time to
> > > get some real-life numbers to prove my argument.
> >
> > I don't really think it's a good idea to focus on testing in this case, because
> > our testing will only cover several specific configurations.
> >
> > Instead, I'd like to design things so that the assumptions are verified as we
> > progress and something special is done if they happen to be not satisfied.
> > If you think they are almost surely satisfied in all practically relevant
> > situations, that "something" may be to fail hibernation and roll back to the
> > working state. If it never happens in practice, that's just fine. Still, IMO
> > we can't just say "this never happens" without saying why _exactly_ this is the
> > case.
>
> I certainly agree with trying to make things as predictable and
> verifiable as possible, but we're not going to achieve that aim
> perfectly here - there are too many other factors in play.
>
> The best I can say is that using an extra pages allowance has worked for
> myself and TuxOnIce users for at least a few years. Once you've done a
> cycle or two, you know what to expect. I know this isn't absolute
> certainty, but as I said above, we're interacting with other kernel
> components that are blackboxes - at least at the moment.
Short term, I agree. Long term we need something more reliable and not
requiring the user input.
Best,
Rafael
next prev parent reply other threads:[~2009-05-26 22:27 UTC|newest]
Thread overview: 141+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-06 14:38 Nigel Cunningham
2009-05-06 14:38 ` [PATCH 1/19] TuxOnIce: Documentation Nigel Cunningham
2009-05-16 20:10 ` Vegard Nossum
2009-05-16 22:18 ` Nigel Cunningham
2009-05-06 14:38 ` [PATCH 2/19] TuxOnIce: GEMS support Nigel Cunningham
2009-05-06 14:38 ` [PATCH 3/19] TuxOnIce: Make drop_pagecache non-static and declared in mm.h Nigel Cunningham
2009-05-06 14:39 ` [PATCH 4/19] TuxOnIce: Add support for just thawing kernel threads Nigel Cunningham
2009-05-06 14:39 ` [PATCH 5/19] TuxOnIce: Create means of determining how many pages can be allocated Nigel Cunningham
2009-05-06 14:39 ` [PATCH 6/19] TuxOnIce: Make functions and variables shared with swsusp non-static Nigel Cunningham
2009-05-06 14:39 ` [PATCH 7/19] TuxOnIce: Modify swsusp bitmaps to allow modification during scanning Nigel Cunningham
2009-05-06 14:39 ` [PATCH 8/19] TuxOnIce: Add core TuxOnIce code Nigel Cunningham
2009-05-06 14:39 ` [PATCH 9/19] TuxOnIce: Netlink support Nigel Cunningham
2009-05-06 21:03 ` Sam Ravnborg
2009-05-06 21:35 ` Nigel Cunningham
2009-05-07 4:34 ` Sam Ravnborg
2009-05-06 14:39 ` [PATCH 10/19] TuxOnIce: Storage manager support Nigel Cunningham
2009-05-06 14:39 ` [PATCH 11/19] TuxOnIce: Block I/O engine Nigel Cunningham
2009-05-06 14:39 ` [PATCH 12/19] TuxOnIce: Compression support Nigel Cunningham
2009-05-06 14:39 ` [PATCH 13/19] TuxOnIce: File allocator Nigel Cunningham
2009-05-06 14:39 ` [PATCH 14/19] TuxOnIce: Swap support Nigel Cunningham
2009-05-06 14:39 ` [PATCH 15/19] TuxOnIce: Userspace user interface support Nigel Cunningham
2009-05-06 14:39 ` [PATCH 16/19] TuxOnIce: Warn user if an initrd doesn't include an attempt at resuming Nigel Cunningham
2009-05-06 14:39 ` [PATCH 17/19] TuxOnIce: Support for replacing swsusp Nigel Cunningham
2009-05-06 14:39 ` [PATCH 18/19] TuxOnIce: Provide a means of determining the freezer state Nigel Cunningham
2009-05-06 14:39 ` [PATCH 19/19] TuxOnIce: Don't try to wake kswapd if the freezer is on Nigel Cunningham
2009-05-07 12:09 ` [RFC] TuxOnIce Pavel Machek
2009-05-07 15:28 ` [TuxOnIce-devel] " Kenneth Crudup
2009-05-07 17:05 ` Kenneth Crudup
2009-05-09 9:10 ` Stefan Richter
2009-05-10 5:37 ` Pavel Machek
2009-05-10 5:37 ` Pavel Machek
2009-05-07 16:55 ` U Kuehn
2009-05-07 17:45 ` Rafael J. Wysocki
2009-05-07 17:49 ` Kenneth Crudup
2009-05-07 18:54 ` Fabio Comolli
2009-05-07 18:57 ` Kenneth Crudup
2009-05-07 17:52 ` Matt Price
2009-05-07 18:22 ` Rafael J. Wysocki
2009-05-07 18:57 ` Fabio Comolli
2009-05-07 19:27 ` Rafael J. Wysocki
2009-05-07 20:41 ` Nigel Cunningham
2009-05-07 23:14 ` Jesse Barnes
2009-05-07 23:32 ` Nigel Cunningham
2009-05-07 23:43 ` Jesse Barnes
2009-05-08 0:13 ` Nigel Cunningham
2009-05-08 0:39 ` Jesse Barnes
2009-05-08 0:49 ` Nigel Cunningham
2009-05-08 0:18 ` Rafael J. Wysocki
2009-05-07 21:46 ` Pavel Machek
2009-05-08 7:11 ` Fabio Comolli
2009-05-07 21:42 ` Pavel Machek
2009-05-08 0:11 ` Alex Goebel
2009-05-07 17:42 ` Rafael J. Wysocki
2009-05-07 20:37 ` Nigel Cunningham
2009-05-07 21:51 ` Pavel Machek
2009-05-08 1:34 ` [TuxOnIce-devel] " Nigel Cunningham
2009-05-08 14:11 ` Rafael J. Wysocki
2009-05-08 21:52 ` Nigel Cunningham
2009-05-08 22:46 ` Rafael J. Wysocki
2009-05-08 23:30 ` Nigel Cunningham
2009-05-08 23:43 ` Rafael J. Wysocki
2009-05-25 10:05 ` Nigel Cunningham
2009-05-25 12:43 ` Pavel Machek
2009-05-25 13:15 ` Nigel Cunningham
2009-05-25 21:43 ` Rafael J. Wysocki
[not found] ` <1243288705.16743.129.camel@nigel-laptop>
2009-05-25 22:39 ` Rafael J. Wysocki
2009-05-26 0:39 ` Nigel Cunningham
2009-05-26 22:27 ` Rafael J. Wysocki [this message]
2009-05-27 0:02 ` Nigel Cunningham
2009-05-27 18:26 ` [linux-pm] " Len Brown
2009-05-25 22:45 ` Oliver Neukum
2009-05-25 22:58 ` Rafael J. Wysocki
2009-05-25 23:13 ` Oliver Neukum
2009-05-27 14:38 ` Martin Steigerwald
2009-05-26 0:42 ` Nigel Cunningham
2009-05-26 9:19 ` Pavel Machek
2009-05-26 11:07 ` Oliver Neukum
2009-05-26 21:33 ` Nigel Cunningham
2009-05-26 21:56 ` [linux-pm] " Alan Stern
2009-05-26 22:24 ` Oliver Neukum
2009-05-27 0:00 ` Nigel Cunningham
2009-05-26 23:59 ` Nigel Cunningham
2009-05-26 21:36 ` Pavel Machek
2009-05-26 21:29 ` Nigel Cunningham
2009-05-26 22:51 ` Oliver Neukum
2009-05-26 23:10 ` Rafael J. Wysocki
2009-05-26 0:42 ` Nigel Cunningham
2009-05-08 23:44 ` Ray Lee
2009-05-27 19:10 ` Len Brown
2009-05-27 23:43 ` Nigel Cunningham
2009-05-09 13:54 ` Pavel Machek
2009-05-25 9:53 ` Nigel Cunningham
2009-05-25 22:02 ` Rafael J. Wysocki
2009-05-26 0:19 ` Nigel Cunningham
2009-05-26 22:37 ` Rafael J. Wysocki
2009-05-27 0:06 ` Nigel Cunningham
2009-05-28 11:50 ` Pavel Machek
2009-05-09 13:27 ` Pavel Machek
2009-05-09 19:32 ` Rafael J. Wysocki
2009-05-09 22:22 ` Nigel Cunningham
2009-05-14 9:16 ` Pavel Machek
2009-05-16 23:11 ` Nigel Cunningham
2009-05-09 13:03 ` Pavel Machek
2009-05-08 19:44 ` Bartlomiej Zolnierkiewicz
2009-05-08 21:03 ` Rafael J. Wysocki
2009-05-08 22:37 ` Nigel Cunningham
2009-05-08 21:59 ` Nigel Cunningham
2009-05-08 23:05 ` Bartlomiej Zolnierkiewicz
2009-05-08 23:15 ` Nigel Cunningham
2009-05-09 13:58 ` Pavel Machek
2009-05-25 9:27 ` Nigel Cunningham
2009-05-25 12:32 ` Pavel Machek
2009-05-25 13:22 ` Oliver Neukum
2009-05-25 13:26 ` Pavel Machek
2009-05-25 21:50 ` Nigel Cunningham
2009-05-25 21:39 ` Nigel Cunningham
2009-05-25 22:29 ` Oliver Neukum
2009-05-26 0:28 ` Nigel Cunningham
2009-05-26 0:35 ` david
2009-05-26 0:47 ` Nigel Cunningham
2009-05-26 8:43 ` Pavel Machek
2009-05-26 10:56 ` Oliver Neukum
2009-05-09 11:12 ` Pekka Enberg
2009-05-07 22:37 ` trekker.dk
2009-05-08 1:17 ` Shannon McMackin
2009-05-08 21:47 ` Fabio Comolli
2009-05-10 5:38 ` Pavel Machek
2009-05-11 20:10 ` Vladislav Bolkhovitin
2009-05-10 5:38 ` Pavel Machek
2009-05-11 21:19 ` trekker.dk
2009-05-11 21:23 ` Pavel Machek
2009-05-13 20:19 ` trekker.dk
2009-05-13 20:24 ` Pavel Machek
2009-05-13 22:07 ` trekker.dk
2009-05-11 23:23 ` Alex Goebel
2009-05-16 19:07 ` Martin Steigerwald
2009-05-17 2:53 ` Matt Price
2009-05-17 3:06 ` Nigel Cunningham
2009-05-17 3:24 ` Matt Price
2009-05-17 3:57 ` Benjamin Herrenschmidt
2009-05-17 5:02 ` Nigel Cunningham
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200905270027.41898.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=nigel@tuxonice.net \
--cc=pavel@ucw.cz \
--cc=tuxonice-devel@lists.tuxonice.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome