Re: [Bug #13058] First hibernation attempt fails

Pavel Machek
2009-04-20T19:53:06Z

Hi!

> > > And the thing is, that "swsusp_shrink_memory()" is just full of
> > > heuristics. There's no hard numbers there. It doesn't seem to wait for
> > > writeout, it just does the equivalent of "shrink_list()" and
> > > "shrink_slab()", but it seems to have been basically cribbed half-way
> > > from the regular "try to free memory", without really doing it all.
> >
> > akpm designed shrink_memory(). Long time ago it was just while (1)
> > kmalloc() loop. It should be waiting. Andrew?
>
> I always wanted the thing to just allocate all the memory which it
> needed and then to either return it all to the caller or free it all
> again for the caller to reallocate (preferably the former).

We need half of memory free for swsusp to work. If we "just allocate"
it, we will trigger OOM killer; we'd prefer to fail suspend than to
OOM kill.

> But for some reason which I don't recall (Pavel provided it, iirc)
> that

Alas, I do not remember that clearly.

> doesn't work. So the current (and subsequently tweaked) scheme was put
> in there instead. It turned out to be surprisingly difficult and ugly
> to graft it in top of the existing page reclaim code, and various
> changes were subsequently made to make it sort-of-work.
>
> Remind me: why can't we just allocate N pages at suspend-time?

We need half of memory free. The reason we can't "just allocate" is
probably OOM killer; but my memories are quite weak :-(.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html