]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.32.10/pm-hibernate-fix-preallocating-of-memory.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.10 / pm-hibernate-fix-preallocating-of-memory.patch
1 From a9c9b4429df437982d2fbfab1f4b46b01329e9ed Mon Sep 17 00:00:00 2001
2 From: Rafael J. Wysocki <rjw@sisk.pl>
3 Date: Thu, 25 Feb 2010 22:32:37 +0100
4 Subject: PM / Hibernate: Fix preallocating of memory
5
6 From: Rafael J. Wysocki <rjw@sisk.pl>
7
8 commit a9c9b4429df437982d2fbfab1f4b46b01329e9ed upstream.
9
10 The hibernate memory preallocation code allocates memory to push some
11 user space data out of physical RAM, so that the hibernation image is
12 not too large. It allocates more memory than necessary for creating
13 the image, so it has to release some pages to make room for
14 allocations made while suspending devices and disabling nonboot CPUs,
15 or the system will hang due to the lack of free pages to allocate
16 from. Unfortunately, the function used for freeing these pages,
17 free_unnecessary_pages(), contains a bug that prevents it from doing
18 the job on all systems without highmem.
19
20 Fix this problem, which is a regression from the 2.6.30 kernel, by
21 using the right condition for the termination of the loop in
22 free_unnecessary_pages().
23
24 Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
25 Reported-and-tested-by: Alan Jenkins <sourcejedi.lkml@googlemail.com>
26 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
27
28 ---
29 kernel/power/snapshot.c | 2 +-
30 1 file changed, 1 insertion(+), 1 deletion(-)
31
32 --- a/kernel/power/snapshot.c
33 +++ b/kernel/power/snapshot.c
34 @@ -1181,7 +1181,7 @@ static void free_unnecessary_pages(void)
35
36 memory_bm_position_reset(&copy_bm);
37
38 - while (to_free_normal > 0 && to_free_highmem > 0) {
39 + while (to_free_normal > 0 || to_free_highmem > 0) {
40 unsigned long pfn = memory_bm_next_pfn(&copy_bm);
41 struct page *page = pfn_to_page(pfn);
42