X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=kernel%2Fpower%2Fsnapshot.c;h=380291efe788bda7bba61bbbed522345334ab8c6;hb=103ebb406f8ddb3008848d6a243299e5b7ddf2f3;hp=cbe2c14413927c665f25d778fb03fde84af73421;hpb=ddddefa99db4ae54a63dcd737d224bc3cc0f2d8a;p=pandora-kernel.git diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index cbe2c1441392..380291efe788 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -1390,7 +1390,11 @@ int hibernate_preallocate_memory(void) * highmem and non-highmem zones separately. */ pages_highmem = preallocate_image_highmem(highmem / 2); - alloc = (count - max_size) - pages_highmem; + alloc = count - max_size; + if (alloc > pages_highmem) + alloc -= pages_highmem; + else + alloc = 0; pages = preallocate_image_memory(alloc, avail_normal); if (pages < alloc) { /* We have exhausted non-highmem pages, try highmem. */