Skip to contentSkip to conversation

: Improve performance of LZO/plain hibernation, check image with CRC32

PATCH Superseded Bojan Smojver 1 participant 1 message Oct 11, 2011

Subsystems (2)

v10 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

PATCH v10 1/1 : Improve performance of LZO/plain hibernation, check image with CRC32

Just a couple of minor changes to the way we do read buffering on thaw. It seems that having more pages in the ring buffer helps. However, in order to be careful with available memory, we calculate how many pages are really available for this, before we start allocating. Also, once we reach minimum required count of the buffer pages, we no longer use __GFP_HIGH to allocate more.

---------------------------------------
Use threads for LZO compression/decompression on hibernate/thaw. Improve buffering on hibernate/thaw.
Calculate/verify CRC32 of the image pages on hibernate/thaw. v10

In my testing, this improved write/read speed by a factor of about two.

---
 kernel/power/Kconfig     |    1 +
 kernel/power/hibernate.c |    3 +
 kernel/power/power.h     |    1 +
 kernel/power/swap.c      |  826 ++++++++++++++++++++++++++++++++++++----------
 4 files changed, 652 insertions(+), 179 deletions(-)
kernel/power/Kconfig +1 -0
index 3744c59..e675045 100644
@@ -27,6 +27,7 @@ config HIBERNATION
 	select HIBERNATE_CALLBACKS
 	select LZO_COMPRESS
 	select LZO_DECOMPRESS
+	select CRC32
 	---help---
 	  Enable the suspend to disk (STD) functionality, which is usually
 	  called "hibernation" in user interfaces.  STD checkpoints the
kernel/power/hibernate.c +3 -0
index 8f7b1db..5c8aa9c 100644
@@ -650,6 +650,9 @@ int hibernate(void)
 			flags |= SF_PLATFORM_MODE;
 		if (nocompress)
 			flags |= SF_NOCOMPRESS_MODE;
+		else
+		        flags |= SF_CRC32_MODE;
+
 		pr_debug("PM: writing image.\n");
 		error = swsusp_write(flags);
 		swsusp_free();
kernel/power/power.h +1 -0
index 9a00a0a..f543583 100644
@@ -146,6 +146,7 @@ extern int swsusp_swap_in_use(void);
  */
 #define SF_PLATFORM_MODE	1
 #define SF_NOCOMPRESS_MODE	2
+#define SF_CRC32_MODE	        4
 
 /* kernel/power/hibernate.c */
 extern int swsusp_check(void);
kernel/power/swap.c +647 -179

1,075 lines not on this page · raw message

---------------------------------------

Signature · 1 line
Bojan