Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f996fc96 authored by Bojan Smojver's avatar Bojan Smojver Committed by Rafael J. Wysocki
Browse files

PM / Hibernate: Compress hibernation image with LZO



Compress hibernation image with LZO in order to save on I/O and
therefore time to hibernate/thaw.

[rjw: Added hibernate=nocompress command line option instead of just
 nocompress which would be confusing, fixed a couple of compiler
 warnings, fixed kerneldoc comments, minor cleanups.]

Signed-off-by: default avatarBojan Smojver <bojan@rexursive.com>
Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
parent 05aa55dd
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -2165,6 +2165,11 @@ and is between 256 and 4096 characters. It is defined in the file
			in <PAGE_SIZE> units (needed only for swap files).
			See  Documentation/power/swsusp-and-swap-files.txt

	hibernate=	[HIBERNATION]
		noresume	Don't check if there's a hibernation image
				present during boot.
		nocompress	Don't compress/decompress hibernation images.

	retain_initrd	[RAM] Keep initrd memory after extraction

	rhash_entries=	[KNL,NET]
+2 −1
Original line number Diff line number Diff line
@@ -66,7 +66,8 @@ swsusp saves the state of the machine into active swaps and then reboots or
powerdowns.  You must explicitly specify the swap partition to resume from with
``resume='' kernel option. If signature is found it loads and restores saved
state. If the option ``noresume'' is specified as a boot parameter, it skips
the resuming.
the resuming.  If the option ``hibernate=nocompress'' is specified as a boot
parameter, it saves hibernation image without compression.

In the meantime while the system is suspended you should not add/remove any
of the hardware, write to the filesystems, etc.
+2 −0
Original line number Diff line number Diff line
@@ -137,6 +137,8 @@ config SUSPEND_FREEZER
config HIBERNATION
	bool "Hibernation (aka 'suspend to disk')"
	depends on PM && SWAP && ARCH_HIBERNATION_POSSIBLE
	select LZO_COMPRESS
	select LZO_DECOMPRESS
	select SUSPEND_NVS if HAS_IOMEM
	---help---
	  Enable the suspend to disk (STD) functionality, which is usually
+13 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include "power.h"


static int nocompress = 0;
static int noresume = 0;
static char resume_file[256] = CONFIG_PM_STD_PARTITION;
dev_t swsusp_resume_device;
@@ -638,6 +639,8 @@ int hibernate(void)

		if (hibernation_mode == HIBERNATION_PLATFORM)
			flags |= SF_PLATFORM_MODE;
		if (nocompress)
			flags |= SF_NOCOMPRESS_MODE;
		pr_debug("PM: writing image.\n");
		error = swsusp_write(flags);
		swsusp_free();
@@ -1004,6 +1007,15 @@ static int __init resume_offset_setup(char *str)
	return 1;
}

static int __init hibernate_setup(char *str)
{
	if (!strncmp(str, "noresume", 8))
		noresume = 1;
	else if (!strncmp(str, "nocompress", 10))
		nocompress = 1;
	return 1;
}

static int __init noresume_setup(char *str)
{
	noresume = 1;
@@ -1013,3 +1025,4 @@ static int __init noresume_setup(char *str)
__setup("noresume", noresume_setup);
__setup("resume_offset=", resume_offset_setup);
__setup("resume=", resume_setup);
__setup("hibernate=", hibernate_setup);
+1 −0
Original line number Diff line number Diff line
@@ -134,6 +134,7 @@ extern int swsusp_swap_in_use(void);
 * the image header.
 */
#define SF_PLATFORM_MODE	1
#define SF_NOCOMPRESS_MODE	2

/* kernel/power/hibernate.c */
extern int swsusp_check(void);
Loading