aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/power/power.h2
-rw-r--r--kernel/power/snapshot.c26
2 files changed, 14 insertions, 14 deletions
diff --git a/kernel/power/power.h b/kernel/power/power.h
index 1cefcf87a694..e18ba207e784 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -38,8 +38,6 @@ extern struct subsystem power_subsys;
38/* References to section boundaries */ 38/* References to section boundaries */
39extern const void __nosave_begin, __nosave_end; 39extern const void __nosave_begin, __nosave_end;
40 40
41extern struct pbe *pagedir_nosave;
42
43/* Preferred image size in bytes (default 500 MB) */ 41/* Preferred image size in bytes (default 500 MB) */
44extern unsigned long image_size; 42extern unsigned long image_size;
45extern int in_suspend; 43extern int in_suspend;
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index 4ca372f2bc14..1d276b3ae152 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -34,7 +34,9 @@
34 34
35#include "power.h" 35#include "power.h"
36 36
37struct pbe *pagedir_nosave; 37/* List of PBEs used for creating and restoring the suspend image */
38struct pbe *restore_pblist;
39
38static unsigned int nr_copy_pages; 40static unsigned int nr_copy_pages;
39static unsigned int nr_meta_pages; 41static unsigned int nr_meta_pages;
40static unsigned long *buffer; 42static unsigned long *buffer;
@@ -415,7 +417,7 @@ void swsusp_free(void)
415 } 417 }
416 nr_copy_pages = 0; 418 nr_copy_pages = 0;
417 nr_meta_pages = 0; 419 nr_meta_pages = 0;
418 pagedir_nosave = NULL; 420 restore_pblist = NULL;
419 buffer = NULL; 421 buffer = NULL;
420} 422}
421 423
@@ -490,15 +492,15 @@ asmlinkage int swsusp_save(void)
490 return -ENOMEM; 492 return -ENOMEM;
491 } 493 }
492 494
493 pagedir_nosave = swsusp_alloc(nr_pages); 495 restore_pblist = swsusp_alloc(nr_pages);
494 if (!pagedir_nosave) 496 if (!restore_pblist)
495 return -ENOMEM; 497 return -ENOMEM;
496 498
497 /* During allocating of suspend pagedir, new cold pages may appear. 499 /* During allocating of suspend pagedir, new cold pages may appear.
498 * Kill them. 500 * Kill them.
499 */ 501 */
500 drain_local_pages(); 502 drain_local_pages();
501 copy_data_pages(pagedir_nosave); 503 copy_data_pages(restore_pblist);
502 504
503 /* 505 /*
504 * End of critical section. From now on, we can write to memory, 506 * End of critical section. From now on, we can write to memory,
@@ -580,13 +582,13 @@ int snapshot_read_next(struct snapshot_handle *handle, size_t count)
580 if (!handle->offset) { 582 if (!handle->offset) {
581 init_header((struct swsusp_info *)buffer); 583 init_header((struct swsusp_info *)buffer);
582 handle->buffer = buffer; 584 handle->buffer = buffer;
583 handle->pbe = pagedir_nosave; 585 handle->pbe = restore_pblist;
584 } 586 }
585 if (handle->prev < handle->cur) { 587 if (handle->prev < handle->cur) {
586 if (handle->cur <= nr_meta_pages) { 588 if (handle->cur <= nr_meta_pages) {
587 handle->pbe = pack_orig_addresses(buffer, handle->pbe); 589 handle->pbe = pack_orig_addresses(buffer, handle->pbe);
588 if (!handle->pbe) 590 if (!handle->pbe)
589 handle->pbe = pagedir_nosave; 591 handle->pbe = restore_pblist;
590 } else { 592 } else {
591 handle->buffer = (void *)handle->pbe->address; 593 handle->buffer = (void *)handle->pbe->address;
592 handle->pbe = handle->pbe->next; 594 handle->pbe = handle->pbe->next;
@@ -689,7 +691,7 @@ static int load_header(struct snapshot_handle *handle,
689 pblist = alloc_pagedir(info->image_pages, GFP_ATOMIC, 0); 691 pblist = alloc_pagedir(info->image_pages, GFP_ATOMIC, 0);
690 if (!pblist) 692 if (!pblist)
691 return -ENOMEM; 693 return -ENOMEM;
692 pagedir_nosave = pblist; 694 restore_pblist = pblist;
693 handle->pbe = pblist; 695 handle->pbe = pblist;
694 nr_copy_pages = info->image_pages; 696 nr_copy_pages = info->image_pages;
695 nr_meta_pages = info->pages - info->image_pages - 1; 697 nr_meta_pages = info->pages - info->image_pages - 1;
@@ -716,7 +718,7 @@ static inline struct pbe *unpack_orig_addresses(unsigned long *buf,
716 718
717/** 719/**
718 * prepare_image - use metadata contained in the PBE list 720 * prepare_image - use metadata contained in the PBE list
719 * pointed to by pagedir_nosave to mark the pages that will 721 * pointed to by restore_pblist to mark the pages that will
720 * be overwritten in the process of restoring the system 722 * be overwritten in the process of restoring the system
721 * memory state from the image ("unsafe" pages) and allocate 723 * memory state from the image ("unsafe" pages) and allocate
722 * memory for the image 724 * memory for the image
@@ -741,7 +743,7 @@ static int prepare_image(struct snapshot_handle *handle)
741 unsigned int nr_pages = nr_copy_pages; 743 unsigned int nr_pages = nr_copy_pages;
742 struct pbe *p, *pblist = NULL; 744 struct pbe *p, *pblist = NULL;
743 745
744 p = pagedir_nosave; 746 p = restore_pblist;
745 error = mark_unsafe_pages(p); 747 error = mark_unsafe_pages(p);
746 if (!error) { 748 if (!error) {
747 pblist = alloc_pagedir(nr_pages, GFP_ATOMIC, 1); 749 pblist = alloc_pagedir(nr_pages, GFP_ATOMIC, 1);
@@ -773,7 +775,7 @@ static int prepare_image(struct snapshot_handle *handle)
773 } 775 }
774 } 776 }
775 if (!error) { 777 if (!error) {
776 pagedir_nosave = pblist; 778 restore_pblist = pblist;
777 } else { 779 } else {
778 handle->pbe = NULL; 780 handle->pbe = NULL;
779 swsusp_free(); 781 swsusp_free();
@@ -858,7 +860,7 @@ int snapshot_write_next(struct snapshot_handle *handle, size_t count)
858 error = prepare_image(handle); 860 error = prepare_image(handle);
859 if (error) 861 if (error)
860 return error; 862 return error;
861 handle->pbe = pagedir_nosave; 863 handle->pbe = restore_pblist;
862 handle->last_pbe = NULL; 864 handle->last_pbe = NULL;
863 handle->buffer = get_buffer(handle); 865 handle->buffer = get_buffer(handle);
864 handle->sync_read = 0; 866 handle->sync_read = 0;