File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4444/sys/power/image_size controls the size of the image created by
4545the suspend-to-disk mechanism. It can be written a string
4646representing a non-negative integer that will be used as an upper
47- limit of the image size, in megabytes . The suspend-to-disk mechanism will
47+ limit of the image size, in bytes . The suspend-to-disk mechanism will
4848do its best to ensure the image size will not exceed that number. However,
4949if this turns out to be impossible, it will try to suspend anyway using the
5050smallest image possible. In particular, if "0" is written to this file, the
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ echo shutdown > /sys/power/disk; echo disk > /sys/power/state
2727
2828echo platform > /sys/power/disk; echo disk > /sys/power/state
2929
30- If you want to limit the suspend image size to N megabytes , do
30+ If you want to limit the suspend image size to N bytes , do
3131
3232echo N > /sys/power/image_size
3333
Original file line number Diff line number Diff line change @@ -367,14 +367,14 @@ power_attr(resume);
367367
368368static ssize_t image_size_show (struct subsystem * subsys , char * buf )
369369{
370- return sprintf (buf , "%u \n" , image_size );
370+ return sprintf (buf , "%lu \n" , image_size );
371371}
372372
373373static ssize_t image_size_store (struct subsystem * subsys , const char * buf , size_t n )
374374{
375- unsigned int size ;
375+ unsigned long size ;
376376
377- if (sscanf (buf , "%u " , & size ) == 1 ) {
377+ if (sscanf (buf , "%lu " , & size ) == 1 ) {
378378 image_size = size ;
379379 return n ;
380380 }
Original file line number Diff line number Diff line change @@ -51,8 +51,8 @@ extern const void __nosave_begin, __nosave_end;
5151extern unsigned int nr_copy_pages ;
5252extern struct pbe * pagedir_nosave ;
5353
54- /* Preferred image size in MB (default 500) */
55- extern unsigned int image_size ;
54+ /* Preferred image size in bytes (default 500 MB ) */
55+ extern unsigned long image_size ;
5656
5757extern asmlinkage int swsusp_arch_suspend (void );
5858extern asmlinkage int swsusp_arch_resume (void );
Original file line number Diff line number Diff line change 7070#include "power.h"
7171
7272/*
73- * Preferred image size in MB (tunable via /sys/power/image_size).
73+ * Preferred image size in bytes (tunable via /sys/power/image_size).
7474 * When it is set to N, swsusp will do its best to ensure the image
75- * size will not exceed N MB , but if that is impossible, it will
75+ * size will not exceed N bytes , but if that is impossible, it will
7676 * try to create the smallest image possible.
7777 */
78- unsigned int image_size = 500 ;
78+ unsigned long image_size = 500 * 1024 * 1024 ;
7979
8080#ifdef CONFIG_HIGHMEM
8181unsigned int count_highmem_pages (void );
@@ -590,7 +590,7 @@ int swsusp_shrink_memory(void)
590590 if (!tmp )
591591 return - ENOMEM ;
592592 pages += tmp ;
593- } else if (size > ( image_size * 1024 * 1024 ) / PAGE_SIZE ) {
593+ } else if (size > image_size / PAGE_SIZE ) {
594594 tmp = shrink_all_memory (SHRINK_BITE );
595595 pages += tmp ;
596596 }
You can’t perform that action at this time.
0 commit comments