diff options
-rw-r--r-- | include/linux/suspend.h | 11 | ||||
-rw-r--r-- | kernel/power/snapshot.c | 12 |
2 files changed, 19 insertions, 4 deletions
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 9d2aa1a12aa0..1f2f7ba9e709 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
@@ -34,13 +34,22 @@ static inline void pm_restore_console(void) {} | |||
34 | 34 | ||
35 | #if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND) | 35 | #if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND) |
36 | /* kernel/power/snapshot.c */ | 36 | /* kernel/power/snapshot.c */ |
37 | extern void __init register_nosave_region(unsigned long, unsigned long); | 37 | extern void __register_nosave_region(unsigned long b, unsigned long e, int km); |
38 | static inline void register_nosave_region(unsigned long b, unsigned long e) | ||
39 | { | ||
40 | __register_nosave_region(b, e, 0); | ||
41 | } | ||
42 | static inline void register_nosave_region_late(unsigned long b, unsigned long e) | ||
43 | { | ||
44 | __register_nosave_region(b, e, 1); | ||
45 | } | ||
38 | extern int swsusp_page_is_forbidden(struct page *); | 46 | extern int swsusp_page_is_forbidden(struct page *); |
39 | extern void swsusp_set_page_free(struct page *); | 47 | extern void swsusp_set_page_free(struct page *); |
40 | extern void swsusp_unset_page_free(struct page *); | 48 | extern void swsusp_unset_page_free(struct page *); |
41 | extern unsigned long get_safe_page(gfp_t gfp_mask); | 49 | extern unsigned long get_safe_page(gfp_t gfp_mask); |
42 | #else | 50 | #else |
43 | static inline void register_nosave_region(unsigned long b, unsigned long e) {} | 51 | static inline void register_nosave_region(unsigned long b, unsigned long e) {} |
52 | static inline void register_nosave_region_late(unsigned long b, unsigned long e) {} | ||
44 | static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } | 53 | static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } |
45 | static inline void swsusp_set_page_free(struct page *p) {} | 54 | static inline void swsusp_set_page_free(struct page *p) {} |
46 | static inline void swsusp_unset_page_free(struct page *p) {} | 55 | static inline void swsusp_unset_page_free(struct page *p) {} |
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index b7039772b05c..59fb89ba9a4d 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c | |||
@@ -607,7 +607,8 @@ static LIST_HEAD(nosave_regions); | |||
607 | */ | 607 | */ |
608 | 608 | ||
609 | void __init | 609 | void __init |
610 | register_nosave_region(unsigned long start_pfn, unsigned long end_pfn) | 610 | __register_nosave_region(unsigned long start_pfn, unsigned long end_pfn, |
611 | int use_kmalloc) | ||
611 | { | 612 | { |
612 | struct nosave_region *region; | 613 | struct nosave_region *region; |
613 | 614 | ||
@@ -623,8 +624,13 @@ register_nosave_region(unsigned long start_pfn, unsigned long end_pfn) | |||
623 | goto Report; | 624 | goto Report; |
624 | } | 625 | } |
625 | } | 626 | } |
626 | /* This allocation cannot fail */ | 627 | if (use_kmalloc) { |
627 | region = alloc_bootmem_low(sizeof(struct nosave_region)); | 628 | /* during init, this shouldn't fail */ |
629 | region = kmalloc(sizeof(struct nosave_region), GFP_KERNEL); | ||
630 | BUG_ON(!region); | ||
631 | } else | ||
632 | /* This allocation cannot fail */ | ||
633 | region = alloc_bootmem_low(sizeof(struct nosave_region)); | ||
628 | region->start_pfn = start_pfn; | 634 | region->start_pfn = start_pfn; |
629 | region->end_pfn = end_pfn; | 635 | region->end_pfn = end_pfn; |
630 | list_add_tail(®ion->list, &nosave_regions); | 636 | list_add_tail(®ion->list, &nosave_regions); |