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: <1390802395-2336-1-git-send-email-21cnbao@gmail.com>
Date:	Mon, 27 Jan 2014 13:59:55 +0800
From:	Barry Song <21cnbao@...il.com>
To:	len.brown@...el.com, pavel@....cz, rjw@...ysocki.net
Cc:	linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
	workgroup.linux@....com, Barry Song <Baohua.Song@....com>,
	Bin Shi <Bin.Shi@....com>
Subject: [PATCH] kernel/power/swap.c: print the speed of compressed image instead of uncompressed one

From: Barry Song <Baohua.Song@....com>

For users of hibernation, people care more about the size of the compressed
image than uncompressed one. as embedded guys will try to improve the speed
of SD, NAND and do the best to shrink memory to make the image as less as
possible.
so printing the speed of compressed image is more important and making more
senses here.

Signed-off-by: Barry Song <Baohua.Song@....com>
Signed-off-by: Bin Shi <Bin.Shi@....com>
---
 kernel/power/swap.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 7c33ed2..bcb5c51 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -587,6 +587,7 @@ static int save_image_lzo(struct swap_map_handle *handle,
 	unsigned char *page = NULL;
 	struct cmp_data *data = NULL;
 	struct crc_data *crc = NULL;
+	unsigned int nr_cmp_written = 0;
 
 	/*
 	 * We'll limit the number of threads for compression to limit memory
@@ -747,6 +748,8 @@ static int save_image_lzo(struct swap_map_handle *handle,
 			     off += PAGE_SIZE) {
 				memcpy(page, data[thr].cmp + off, PAGE_SIZE);
 
+				nr_cmp_written++;
+
 				ret = swap_write_page(handle, page, &bio);
 				if (ret)
 					goto out_finish;
@@ -764,7 +767,11 @@ out_finish:
 		ret = err2;
 	if (!ret)
 		printk(KERN_INFO "PM: Image saving done.\n");
-	swsusp_show_speed(&start, &stop, nr_to_write, "Wrote");
+
+	printk(KERN_INFO "PM: Saved %lu Kbytes (uncompressed Image)\n",
+		nr_to_write * (PAGE_SIZE / 1024));
+	swsusp_show_speed(&start, &stop, nr_cmp_written, "Wrote compressed");
+
 out_clean:
 	if (crc) {
 		if (crc->thr)
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ