Message ID | 20230302060033.15661-1-luoxueqin@kylinos.cn (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Series | PM/hibernation: set the default image size for large memory | expand |
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index cd8b7b35f1e8..de91d6916359 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -136,7 +136,14 @@ unsigned long image_size; void __init hibernate_image_size_init(void) { - image_size = ((totalram_pages() * 2) / 5) * PAGE_SIZE; + /* The totalram pages() for a computer of 16 memory size is + * equal to 4032990 pages. And according to our observation, + * the average image size is 1000000 pages. + */ + if (totalram_pages() < 4032990) + image_size = ((totalram_pages() * 2) / 5) * PAGE_SIZE; + else + image_size = 1000000 * PAGE_SIZE; } /*