[PATCH 0/4] PM: Drop shrink_all_memory (rev. 2) (was: Re: [PATCH 3/3] PM/Hibernate: Use memory allocations to free memory)

Rafael J. Wysocki
2009-05-03T00:20:57Z

On Saturday 02 May 2009, Andrew Morton wrote:
> On Sat, 2 May 2009 13:46:34 +0200 "Rafael J. Wysocki" <rjw-KKrjLPT3xs0@public.gmane.org> wrote:
>
> > > Do we need the bitmap? I expect we can just string all these pages
> > > onto a local list via page.lru. Would need to check that - the
> > > pageframe fields are quite overloaded.
> >
> > This is the reason why we use the bitmaps for hibernation. :-)
>
> grep the tree for page->lru and you'll see that quite a few page
> consumers are using it. So you'd be pretty safe doing it this way.
>
> Whether it's _worth_ doing it this way is debatable, given that
> hibernation uses bitmaps elsewhere. But it would shrink the patch a
> bit I expect?

It probably would, but it turns out we need not create the new bitmap, we
can use the existing ones for marking the allocated pages. That also has
the benefit that we can use swsusp_free() to release them.

Modified patch series follows:

[1/4] - your patch introducing __GFP_NO_OOM_KILL (I decided it would be better
do it this way in this particular case. The fact that the OOM killer
is not going to work after tasks have been frozen is a different issue.)

[2/4] - move swsusp_shrink_memory to snapshot.c, no major changes

[3/4] - use memory allocations to for making the room for the image (added
comments, used the existing bitmaps, cleaned up a bit)

[4/4] - new thing: do not release memory allocated by [3/4] and use it for
creating the image directly.

Thanks,
Rafael