aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/suspend.h11
-rw-r--r--kernel/power/snapshot.c12
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 */
37extern void __init register_nosave_region(unsigned long, unsigned long); 37extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
38static inline void register_nosave_region(unsigned long b, unsigned long e)
39{
40 __register_nosave_region(b, e, 0);
41}
42static inline void register_nosave_region_late(unsigned long b, unsigned long e)
43{
44 __register_nosave_region(b, e, 1);
45}
38extern int swsusp_page_is_forbidden(struct page *); 46extern int swsusp_page_is_forbidden(struct page *);
39extern void swsusp_set_page_free(struct page *); 47extern void swsusp_set_page_free(struct page *);
40extern void swsusp_unset_page_free(struct page *); 48extern void swsusp_unset_page_free(struct page *);
41extern unsigned long get_safe_page(gfp_t gfp_mask); 49extern unsigned long get_safe_page(gfp_t gfp_mask);
42#else 50#else
43static inline void register_nosave_region(unsigned long b, unsigned long e) {} 51static inline void register_nosave_region(unsigned long b, unsigned long e) {}
52static inline void register_nosave_region_late(unsigned long b, unsigned long e) {}
44static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } 53static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
45static inline void swsusp_set_page_free(struct page *p) {} 54static inline void swsusp_set_page_free(struct page *p) {}
46static inline void swsusp_unset_page_free(struct page *p) {} 55static 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
609void __init 609void __init
610register_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(&region->list, &nosave_regions); 636 list_add_tail(&region->list, &nosave_regions);