Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 212362
b: refs/heads/master
c: ac5c24e
h: refs/heads/master
v: v3
  • Loading branch information
Rafael J. Wysocki committed Oct 16, 2010
1 parent 1f58a25 commit f698812
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 266f1a25eff5ff98c498d7754a419aacfd88f71c
refs/heads/master: ac5c24ec1e983313ef0015258fba6f630e54e7cf
2 changes: 1 addition & 1 deletion trunk/Documentation/power/interface.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ smallest image possible. In particular, if "0" is written to this file, the
suspend image will be as small as possible.

Reading from this file will display the current image size limit, which
is set to 500 MB by default.
is set to 2/5 of available RAM by default.

/sys/power/pm_trace controls the code which saves the last PM event point in
the RTC across reboots, so that you can debug a machine that just hangs
Expand Down
1 change: 1 addition & 0 deletions trunk/kernel/power/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ static int __init pm_init(void)
int error = pm_start_workqueue();
if (error)
return error;
hibernate_image_size_init();
power_kobj = kobject_create_and_add("power", NULL);
if (!power_kobj)
return -ENOMEM;
Expand Down
9 changes: 8 additions & 1 deletion trunk/kernel/power/power.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ struct swsusp_info {
} __attribute__((aligned(PAGE_SIZE)));

#ifdef CONFIG_HIBERNATION
/* kernel/power/snapshot.c */
extern void __init hibernate_image_size_init(void);

#ifdef CONFIG_ARCH_HIBERNATION_HEADER
/* Maximum size of architecture specific data in a hibernation header */
#define MAX_ARCH_HEADER_SIZE (sizeof(struct new_utsname) + 4)
Expand Down Expand Up @@ -49,7 +52,11 @@ static inline char *check_image_kernel(struct swsusp_info *info)
extern int hibernation_snapshot(int platform_mode);
extern int hibernation_restore(int platform_mode);
extern int hibernation_platform_enter(void);
#endif

#else /* !CONFIG_HIBERNATION */

static inline void hibernate_image_size_init(void) {}
#endif /* !CONFIG_HIBERNATION */

extern int pfn_is_nosave(unsigned long);

Expand Down
7 changes: 6 additions & 1 deletion trunk/kernel/power/snapshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ static void swsusp_unset_page_forbidden(struct page *);
* size will not exceed N bytes, but if that is impossible, it will
* try to create the smallest image possible.
*/
unsigned long image_size = 500 * 1024 * 1024;
unsigned long image_size;

void __init hibernate_image_size_init(void)
{
image_size = ((totalram_pages * 2) / 5) * PAGE_SIZE;
}

/* List of PBEs needed for restoring the pages that were allocated before
* the suspend and included in the suspend image, but have also been
Expand Down

0 comments on commit f698812

Please sign in to comment.