diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2006-01-06 03:15:56 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 11:33:42 -0500 |
commit | ca0aec0f7a94bf9f07fefa8bfd23282d4e8ceb8a (patch) | |
tree | 5f31f11eba908545d5e02698fe9c163a8612dd26 /kernel/power/disk.c | |
parent | b3a93a255ec33a04776ec50efb30b7a99168dda2 (diff) |
[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>
Diffstat (limited to 'kernel/power/disk.c')
-rw-r--r-- | kernel/power/disk.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index 9e51cdf7b78d..e24446f8d8cd 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
@@ -365,9 +365,29 @@ out: | |||
365 | 365 | ||
366 | power_attr(resume); | 366 | power_attr(resume); |
367 | 367 | ||
368 | static ssize_t image_size_show(struct subsystem * subsys, char *buf) | ||
369 | { | ||
370 | return sprintf(buf, "%u\n", image_size); | ||
371 | } | ||
372 | |||
373 | static ssize_t image_size_store(struct subsystem * subsys, const char * buf, size_t n) | ||
374 | { | ||
375 | unsigned int size; | ||
376 | |||
377 | if (sscanf(buf, "%u", &size) == 1) { | ||
378 | image_size = size; | ||
379 | return n; | ||
380 | } | ||
381 | |||
382 | return -EINVAL; | ||
383 | } | ||
384 | |||
385 | power_attr(image_size); | ||
386 | |||
368 | static struct attribute * g[] = { | 387 | static struct attribute * g[] = { |
369 | &disk_attr.attr, | 388 | &disk_attr.attr, |
370 | &resume_attr.attr, | 389 | &resume_attr.attr, |
390 | &image_size_attr.attr, | ||
371 | NULL, | 391 | NULL, |
372 | }; | 392 | }; |
373 | 393 | ||