Let's use pfn_to_online_page() instead of pfn_to_page() when checking
for saveable pages to not save/restore offline memory sections.

Cc: "Rafael J. Wysocki" <[email protected]>
Cc: Pavel Machek <[email protected]>
Cc: Len Brown <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Suggested-by: Michal Hocko <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Acked-by: Rafael J. Wysocki <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
---
 kernel/power/snapshot.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index 640b2034edd6..87e6dd57819f 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -1215,8 +1215,8 @@ static struct page *saveable_highmem_page(struct zone 
*zone, unsigned long pfn)
        if (!pfn_valid(pfn))
                return NULL;
 
-       page = pfn_to_page(pfn);
-       if (page_zone(page) != zone)
+       page = pfn_to_online_page(pfn);
+       if (!page || page_zone(page) != zone)
                return NULL;
 
        BUG_ON(!PageHighMem(page));
@@ -1277,8 +1277,8 @@ static struct page *saveable_page(struct zone *zone, 
unsigned long pfn)
        if (!pfn_valid(pfn))
                return NULL;
 
-       page = pfn_to_page(pfn);
-       if (page_zone(page) != zone)
+       page = pfn_to_online_page(pfn);
+       if (!page || page_zone(page) != zone)
                return NULL;
 
        BUG_ON(PageHighMem(page));
-- 
2.17.2

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to