[PATCH] swsusp: make image size limit tunable

Make the suspend image size limit tunable via /sys/power/image_size.

It is necessary for systems on which there is a limited amount of swap
available for suspend.  It can also be useful for optimizing performance of
swsusp on systems with 1 GB of RAM or more.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Rafael J. Wysocki
2006-01-06 00:15:56 -08:00
committed by Linus Torvalds
parent b3a93a255e
commit ca0aec0f7a
5 changed files with 47 additions and 6 deletions

View File

@@ -365,9 +365,29 @@ out:
power_attr(resume);
static ssize_t image_size_show(struct subsystem * subsys, char *buf)
{
return sprintf(buf, "%u\n", image_size);
}
static ssize_t image_size_store(struct subsystem * subsys, const char * buf, size_t n)
{
unsigned int size;
if (sscanf(buf, "%u", &size) == 1) {
image_size = size;
return n;
}
return -EINVAL;
}
power_attr(image_size);
static struct attribute * g[] = {
&disk_attr.attr,
&resume_attr.attr,
&image_size_attr.attr,
NULL,
};