]> git.karo-electronics.de Git - karo-tx-linux.git/commit
PM / Hibernate: Avoid hitting OOM during preallocation of memory
authorRafael J. Wysocki <rjw@sisk.pl>
Sat, 11 Sep 2010 18:58:27 +0000 (20:58 +0200)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Thu, 17 May 2012 15:21:04 +0000 (11:21 -0400)
commit561c6e2d14e0ac50eb1716b94fb297177d824478
tree15b9f36230e7e371296984bbbd1928a98836ce53
parentd034c6d3572a43f342e80d3f3af23a042e6e0d91
PM / Hibernate: Avoid hitting OOM during preallocation of memory

commit 6715045ddc7472a22be5e49d4047d2d89b391f45 upstream.

There is a problem in hibernate_preallocate_memory() that it calls
preallocate_image_memory() with an argument that may be greater than
the total number of available non-highmem memory pages.  If that's
the case, the OOM condition is guaranteed to trigger, which in turn
can cause significant slowdown to occur during hibernation.

To avoid that, make preallocate_image_memory() adjust its argument
before calling preallocate_image_pages(), so that the total number of
saveable non-highem pages left is not less than the minimum size of
a hibernation image.  Change hibernate_preallocate_memory() to try to
allocate from highmem if the number of pages allocated by
preallocate_image_memory() is too low.

Modify free_unnecessary_pages() to take all possible memory
allocation patterns into account.

Reported-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Tested-by: M. Vefa Bicakci <bicave@superonline.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
kernel/power/snapshot.c