Merge tag 'pci-v4.9-changes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helga...
[cascardo/linux.git] / kernel / power / snapshot.c
index b022284..4f0f060 100644 (file)
@@ -1132,6 +1132,28 @@ void free_basic_memory_bitmaps(void)
        pr_debug("PM: Basic memory bitmaps freed\n");
 }
 
+void clear_free_pages(void)
+{
+#ifdef CONFIG_PAGE_POISONING_ZERO
+       struct memory_bitmap *bm = free_pages_map;
+       unsigned long pfn;
+
+       if (WARN_ON(!(free_pages_map)))
+               return;
+
+       memory_bm_position_reset(bm);
+       pfn = memory_bm_next_pfn(bm);
+       while (pfn != BM_END_OF_MAP) {
+               if (pfn_valid(pfn))
+                       clear_highpage(pfn_to_page(pfn));
+
+               pfn = memory_bm_next_pfn(bm);
+       }
+       memory_bm_position_reset(bm);
+       pr_info("PM: free pages cleared after restore\n");
+#endif /* PAGE_POISONING_ZERO */
+}
+
 /**
  * snapshot_additional_pages - Estimate the number of extra pages needed.
  * @zone: Memory zone to carry out the computation for.