lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230302060033.15661-1-luoxueqin@kylinos.cn>
Date:   Thu,  2 Mar 2023 14:00:33 +0800
From:   Xueqin Luo <luoxueqin@...inos.cn>
To:     rafael@...nel.org, len.brown@...el.com, pavel@....cz
Cc:     linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        xiongxin@...inos.cn, xueqin Luo <luoxueqin@...inos.cn>
Subject: [PATCH] PM/hibernation: set the default image size for large memory

From: xueqin Luo <luoxueqin@...inos.cn>

We found that the larger the memory, the larger the image saved by the
S4, so that the S4 took longer and longer. However, through observation,
we found that the image size is generally more than 900,000 pages, so
we changed the image_size of a computer with 16GB or more memory to 1
million pages. Let it release more unnecessary pages to reduce S4 run
time.

Signed-off-by: xueqin Luo <luoxueqin@...inos.cn>
---
 kernel/power/snapshot.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

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;
 }
 
 /*
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ