Skip to content

Commit

Permalink
PM / Hibernate: Reduce autotuned default image size
Browse files Browse the repository at this point in the history
The hibernate image size autotuning mechanism sets the default
image size to 5/2 of the total system RAM, but it is reported
that on some systems device drivers allocate substantial
amounts of memory during suspend and the creation of the image
fails as a result (too little memory is preallocated).

Modify the autotuning mechanism to use 1/3 instead of 2/5 of RAM
as the default image size, which is reported to be sufficient for
the affected systems.

References: https://bugzilla.kernel.org/show_bug.cgi?id=30482
Reported-and-tested-by: Martin Steigerwald <Martin@Lichtvoll.de>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
  • Loading branch information
rjwysocki committed Mar 14, 2011
1 parent 40dc166 commit bea3864
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kernel/power/snapshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ static void swsusp_unset_page_forbidden(struct page *);

/*
* Preferred image size in bytes (tunable via /sys/power/image_size).
* When it is set to N, swsusp will do its best to ensure the image
* size will not exceed N bytes, but if that is impossible, it will
* try to create the smallest image possible.
* When it is set to N, the image creating code will do its best to
* ensure the image size will not exceed N bytes, but if that is
* impossible, it will try to create the smallest image possible.
*/
unsigned long image_size;

void __init hibernate_image_size_init(void)
{
image_size = ((totalram_pages * 2) / 5) * PAGE_SIZE;
image_size = (totalram_pages / 3) * PAGE_SIZE;
}

/* List of PBEs needed for restoring the pages that were allocated before
Expand Down

0 comments on commit bea3864

Please sign in to comment.