diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-21 19:33:19 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-21 19:33:19 -0500 |
commit | 20f8d2a49360980f1dc0afe2ea227e3ba887e575 (patch) | |
tree | d2891d4604d3fd40da7a21650d07f83e73ae8d8e /kernel | |
parent | e6364cd3a1a3e7c3e9a80bad15698afe6cc7ee75 (diff) | |
parent | 1f1519ef597ae4628dbd47244f0f68d700231523 (diff) |
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (26 commits)
PM: Make suspend_device() static
PCI ACPI: Fix comment describing acpi_pci_choose_state
Hibernation: Handle DEBUG_PAGEALLOC on x86
ACPI: fix build warning
ACPI: TSC breaks atkbd suspend
ACPI: remove is_processor_present prototype
acer-wmi: Add DMI match for mail LED on Acer TravelMate 4200 series
ACPI: sparse fix, replace macro with static function
ACPI: thinkpad-acpi: add tablet-mode reporting
ACPI: thinkpad-acpi: minor hotkey_radio_sw fixes
ACPI: thinkpad-acpi: improve thinkpad-acpi input device documentation
ACPI: thinkpad-acpi: issue input events for tablet swivel events
ACPI: thinkpad-acpi: make the video output feature optional
ACPI: thinkpad-acpi: synchronize input device switches
ACPI: thinkpad-acpi: always track input device open/close
ACPI: thinkpad-acpi: trivial fix to documentation
ACPI: thinkpad-acpi: trivial fix to module_desc typo
intel_menlo: extract return values using PTR_ERR
ACPI video: check for error from thermal_cooling_device_register
ACPI thermal: extract return values using PTR_ERR
...
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/power/snapshot.c | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 95250d7c8d91..72a020cabb4c 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c | |||
@@ -875,8 +875,8 @@ static inline void *saveable_highmem_page(unsigned long pfn) { return NULL; } | |||
875 | #endif /* CONFIG_HIGHMEM */ | 875 | #endif /* CONFIG_HIGHMEM */ |
876 | 876 | ||
877 | /** | 877 | /** |
878 | * saveable - Determine whether a non-highmem page should be included in | 878 | * saveable_page - Determine whether a non-highmem page should be included |
879 | * the suspend image. | 879 | * in the suspend image. |
880 | * | 880 | * |
881 | * We should save the page if it isn't Nosave, and is not in the range | 881 | * We should save the page if it isn't Nosave, and is not in the range |
882 | * of pages statically defined as 'unsaveable', and it isn't a part of | 882 | * of pages statically defined as 'unsaveable', and it isn't a part of |
@@ -897,7 +897,8 @@ static struct page *saveable_page(unsigned long pfn) | |||
897 | if (swsusp_page_is_forbidden(page) || swsusp_page_is_free(page)) | 897 | if (swsusp_page_is_forbidden(page) || swsusp_page_is_free(page)) |
898 | return NULL; | 898 | return NULL; |
899 | 899 | ||
900 | if (PageReserved(page) && pfn_is_nosave(pfn)) | 900 | if (PageReserved(page) |
901 | && (!kernel_page_present(page) || pfn_is_nosave(pfn))) | ||
901 | return NULL; | 902 | return NULL; |
902 | 903 | ||
903 | return page; | 904 | return page; |
@@ -938,6 +939,25 @@ static inline void do_copy_page(long *dst, long *src) | |||
938 | *dst++ = *src++; | 939 | *dst++ = *src++; |
939 | } | 940 | } |
940 | 941 | ||
942 | |||
943 | /** | ||
944 | * safe_copy_page - check if the page we are going to copy is marked as | ||
945 | * present in the kernel page tables (this always is the case if | ||
946 | * CONFIG_DEBUG_PAGEALLOC is not set and in that case | ||
947 | * kernel_page_present() always returns 'true'). | ||
948 | */ | ||
949 | static void safe_copy_page(void *dst, struct page *s_page) | ||
950 | { | ||
951 | if (kernel_page_present(s_page)) { | ||
952 | do_copy_page(dst, page_address(s_page)); | ||
953 | } else { | ||
954 | kernel_map_pages(s_page, 1, 1); | ||
955 | do_copy_page(dst, page_address(s_page)); | ||
956 | kernel_map_pages(s_page, 1, 0); | ||
957 | } | ||
958 | } | ||
959 | |||
960 | |||
941 | #ifdef CONFIG_HIGHMEM | 961 | #ifdef CONFIG_HIGHMEM |
942 | static inline struct page * | 962 | static inline struct page * |
943 | page_is_saveable(struct zone *zone, unsigned long pfn) | 963 | page_is_saveable(struct zone *zone, unsigned long pfn) |
@@ -946,8 +966,7 @@ page_is_saveable(struct zone *zone, unsigned long pfn) | |||
946 | saveable_highmem_page(pfn) : saveable_page(pfn); | 966 | saveable_highmem_page(pfn) : saveable_page(pfn); |
947 | } | 967 | } |
948 | 968 | ||
949 | static inline void | 969 | static void copy_data_page(unsigned long dst_pfn, unsigned long src_pfn) |
950 | copy_data_page(unsigned long dst_pfn, unsigned long src_pfn) | ||
951 | { | 970 | { |
952 | struct page *s_page, *d_page; | 971 | struct page *s_page, *d_page; |
953 | void *src, *dst; | 972 | void *src, *dst; |
@@ -961,29 +980,26 @@ copy_data_page(unsigned long dst_pfn, unsigned long src_pfn) | |||
961 | kunmap_atomic(src, KM_USER0); | 980 | kunmap_atomic(src, KM_USER0); |
962 | kunmap_atomic(dst, KM_USER1); | 981 | kunmap_atomic(dst, KM_USER1); |
963 | } else { | 982 | } else { |
964 | src = page_address(s_page); | ||
965 | if (PageHighMem(d_page)) { | 983 | if (PageHighMem(d_page)) { |
966 | /* Page pointed to by src may contain some kernel | 984 | /* Page pointed to by src may contain some kernel |
967 | * data modified by kmap_atomic() | 985 | * data modified by kmap_atomic() |
968 | */ | 986 | */ |
969 | do_copy_page(buffer, src); | 987 | safe_copy_page(buffer, s_page); |
970 | dst = kmap_atomic(pfn_to_page(dst_pfn), KM_USER0); | 988 | dst = kmap_atomic(pfn_to_page(dst_pfn), KM_USER0); |
971 | memcpy(dst, buffer, PAGE_SIZE); | 989 | memcpy(dst, buffer, PAGE_SIZE); |
972 | kunmap_atomic(dst, KM_USER0); | 990 | kunmap_atomic(dst, KM_USER0); |
973 | } else { | 991 | } else { |
974 | dst = page_address(d_page); | 992 | safe_copy_page(page_address(d_page), s_page); |
975 | do_copy_page(dst, src); | ||
976 | } | 993 | } |
977 | } | 994 | } |
978 | } | 995 | } |
979 | #else | 996 | #else |
980 | #define page_is_saveable(zone, pfn) saveable_page(pfn) | 997 | #define page_is_saveable(zone, pfn) saveable_page(pfn) |
981 | 998 | ||
982 | static inline void | 999 | static inline void copy_data_page(unsigned long dst_pfn, unsigned long src_pfn) |
983 | copy_data_page(unsigned long dst_pfn, unsigned long src_pfn) | ||
984 | { | 1000 | { |
985 | do_copy_page(page_address(pfn_to_page(dst_pfn)), | 1001 | safe_copy_page(page_address(pfn_to_page(dst_pfn)), |
986 | page_address(pfn_to_page(src_pfn))); | 1002 | pfn_to_page(src_pfn)); |
987 | } | 1003 | } |
988 | #endif /* CONFIG_HIGHMEM */ | 1004 | #endif /* CONFIG_HIGHMEM */ |
989 | 1005 | ||