diff options
Diffstat (limited to 'kernel/power/snapshot.c')
-rw-r--r-- | kernel/power/snapshot.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 78039b477d2b..f6a5df934f8d 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c | |||
@@ -635,7 +635,7 @@ __register_nosave_region(unsigned long start_pfn, unsigned long end_pfn, | |||
635 | region->end_pfn = end_pfn; | 635 | region->end_pfn = end_pfn; |
636 | list_add_tail(®ion->list, &nosave_regions); | 636 | list_add_tail(®ion->list, &nosave_regions); |
637 | Report: | 637 | Report: |
638 | printk("swsusp: Registered nosave memory region: %016lx - %016lx\n", | 638 | printk(KERN_INFO "PM: Registered nosave memory: %016lx - %016lx\n", |
639 | start_pfn << PAGE_SHIFT, end_pfn << PAGE_SHIFT); | 639 | start_pfn << PAGE_SHIFT, end_pfn << PAGE_SHIFT); |
640 | } | 640 | } |
641 | 641 | ||
@@ -704,7 +704,7 @@ static void mark_nosave_pages(struct memory_bitmap *bm) | |||
704 | list_for_each_entry(region, &nosave_regions, list) { | 704 | list_for_each_entry(region, &nosave_regions, list) { |
705 | unsigned long pfn; | 705 | unsigned long pfn; |
706 | 706 | ||
707 | printk("swsusp: Marking nosave pages: %016lx - %016lx\n", | 707 | pr_debug("PM: Marking nosave pages: %016lx - %016lx\n", |
708 | region->start_pfn << PAGE_SHIFT, | 708 | region->start_pfn << PAGE_SHIFT, |
709 | region->end_pfn << PAGE_SHIFT); | 709 | region->end_pfn << PAGE_SHIFT); |
710 | 710 | ||
@@ -749,7 +749,7 @@ int create_basic_memory_bitmaps(void) | |||
749 | free_pages_map = bm2; | 749 | free_pages_map = bm2; |
750 | mark_nosave_pages(forbidden_pages_map); | 750 | mark_nosave_pages(forbidden_pages_map); |
751 | 751 | ||
752 | printk("swsusp: Basic memory bitmaps created\n"); | 752 | pr_debug("PM: Basic memory bitmaps created\n"); |
753 | 753 | ||
754 | return 0; | 754 | return 0; |
755 | 755 | ||
@@ -784,7 +784,7 @@ void free_basic_memory_bitmaps(void) | |||
784 | memory_bm_free(bm2, PG_UNSAFE_CLEAR); | 784 | memory_bm_free(bm2, PG_UNSAFE_CLEAR); |
785 | kfree(bm2); | 785 | kfree(bm2); |
786 | 786 | ||
787 | printk("swsusp: Basic memory bitmaps freed\n"); | 787 | pr_debug("PM: Basic memory bitmaps freed\n"); |
788 | } | 788 | } |
789 | 789 | ||
790 | /** | 790 | /** |
@@ -872,7 +872,6 @@ unsigned int count_highmem_pages(void) | |||
872 | } | 872 | } |
873 | #else | 873 | #else |
874 | static inline void *saveable_highmem_page(unsigned long pfn) { return NULL; } | 874 | static inline void *saveable_highmem_page(unsigned long pfn) { return NULL; } |
875 | static inline unsigned int count_highmem_pages(void) { return 0; } | ||
876 | #endif /* CONFIG_HIGHMEM */ | 875 | #endif /* CONFIG_HIGHMEM */ |
877 | 876 | ||
878 | /** | 877 | /** |
@@ -1089,7 +1088,7 @@ static int enough_free_mem(unsigned int nr_pages, unsigned int nr_highmem) | |||
1089 | } | 1088 | } |
1090 | 1089 | ||
1091 | nr_pages += count_pages_for_highmem(nr_highmem); | 1090 | nr_pages += count_pages_for_highmem(nr_highmem); |
1092 | pr_debug("swsusp: Normal pages needed: %u + %u + %u, available pages: %u\n", | 1091 | pr_debug("PM: Normal pages needed: %u + %u + %u, available pages: %u\n", |
1093 | nr_pages, PAGES_FOR_IO, meta, free); | 1092 | nr_pages, PAGES_FOR_IO, meta, free); |
1094 | 1093 | ||
1095 | return free > nr_pages + PAGES_FOR_IO + meta; | 1094 | return free > nr_pages + PAGES_FOR_IO + meta; |
@@ -1202,20 +1201,20 @@ asmlinkage int swsusp_save(void) | |||
1202 | { | 1201 | { |
1203 | unsigned int nr_pages, nr_highmem; | 1202 | unsigned int nr_pages, nr_highmem; |
1204 | 1203 | ||
1205 | printk("swsusp: critical section: \n"); | 1204 | printk(KERN_INFO "PM: Creating hibernation image: \n"); |
1206 | 1205 | ||
1207 | drain_local_pages(); | 1206 | drain_local_pages(); |
1208 | nr_pages = count_data_pages(); | 1207 | nr_pages = count_data_pages(); |
1209 | nr_highmem = count_highmem_pages(); | 1208 | nr_highmem = count_highmem_pages(); |
1210 | printk("swsusp: Need to copy %u pages\n", nr_pages + nr_highmem); | 1209 | printk(KERN_INFO "PM: Need to copy %u pages\n", nr_pages + nr_highmem); |
1211 | 1210 | ||
1212 | if (!enough_free_mem(nr_pages, nr_highmem)) { | 1211 | if (!enough_free_mem(nr_pages, nr_highmem)) { |
1213 | printk(KERN_ERR "swsusp: Not enough free memory\n"); | 1212 | printk(KERN_ERR "PM: Not enough free memory\n"); |
1214 | return -ENOMEM; | 1213 | return -ENOMEM; |
1215 | } | 1214 | } |
1216 | 1215 | ||
1217 | if (swsusp_alloc(&orig_bm, ©_bm, nr_pages, nr_highmem)) { | 1216 | if (swsusp_alloc(&orig_bm, ©_bm, nr_pages, nr_highmem)) { |
1218 | printk(KERN_ERR "swsusp: Memory allocation failed\n"); | 1217 | printk(KERN_ERR "PM: Memory allocation failed\n"); |
1219 | return -ENOMEM; | 1218 | return -ENOMEM; |
1220 | } | 1219 | } |
1221 | 1220 | ||
@@ -1235,7 +1234,8 @@ asmlinkage int swsusp_save(void) | |||
1235 | nr_copy_pages = nr_pages; | 1234 | nr_copy_pages = nr_pages; |
1236 | nr_meta_pages = DIV_ROUND_UP(nr_pages * sizeof(long), PAGE_SIZE); | 1235 | nr_meta_pages = DIV_ROUND_UP(nr_pages * sizeof(long), PAGE_SIZE); |
1237 | 1236 | ||
1238 | printk("swsusp: critical section: done (%d pages copied)\n", nr_pages); | 1237 | printk(KERN_INFO "PM: Hibernation image created (%d pages copied)\n", |
1238 | nr_pages); | ||
1239 | 1239 | ||
1240 | return 0; | 1240 | return 0; |
1241 | } | 1241 | } |
@@ -1264,12 +1264,17 @@ static char *check_image_kernel(struct swsusp_info *info) | |||
1264 | } | 1264 | } |
1265 | #endif /* CONFIG_ARCH_HIBERNATION_HEADER */ | 1265 | #endif /* CONFIG_ARCH_HIBERNATION_HEADER */ |
1266 | 1266 | ||
1267 | unsigned long snapshot_get_image_size(void) | ||
1268 | { | ||
1269 | return nr_copy_pages + nr_meta_pages + 1; | ||
1270 | } | ||
1271 | |||
1267 | static int init_header(struct swsusp_info *info) | 1272 | static int init_header(struct swsusp_info *info) |
1268 | { | 1273 | { |
1269 | memset(info, 0, sizeof(struct swsusp_info)); | 1274 | memset(info, 0, sizeof(struct swsusp_info)); |
1270 | info->num_physpages = num_physpages; | 1275 | info->num_physpages = num_physpages; |
1271 | info->image_pages = nr_copy_pages; | 1276 | info->image_pages = nr_copy_pages; |
1272 | info->pages = nr_copy_pages + nr_meta_pages + 1; | 1277 | info->pages = snapshot_get_image_size(); |
1273 | info->size = info->pages; | 1278 | info->size = info->pages; |
1274 | info->size <<= PAGE_SHIFT; | 1279 | info->size <<= PAGE_SHIFT; |
1275 | return init_header_complete(info); | 1280 | return init_header_complete(info); |
@@ -1429,7 +1434,7 @@ static int check_header(struct swsusp_info *info) | |||
1429 | if (!reason && info->num_physpages != num_physpages) | 1434 | if (!reason && info->num_physpages != num_physpages) |
1430 | reason = "memory size"; | 1435 | reason = "memory size"; |
1431 | if (reason) { | 1436 | if (reason) { |
1432 | printk(KERN_ERR "swsusp: Resume mismatch: %s\n", reason); | 1437 | printk(KERN_ERR "PM: Image mismatch: %s\n", reason); |
1433 | return -EPERM; | 1438 | return -EPERM; |
1434 | } | 1439 | } |
1435 | return 0; | 1440 | return 0; |