]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - mm/memory_hotplug.c
Merge tag 'amd-drm-fixes-5.6-2020-03-19' of git://people.freedesktop.org/~agd5f/linux...
[linux.git] / mm / memory_hotplug.c
index 0a54ffac8c682ae5c940642c6b5d45cfb22cada5..19389cdc16a502f04726f4e12bab64cb8e4e1879 100644 (file)
@@ -574,7 +574,13 @@ EXPORT_SYMBOL_GPL(restore_online_page_callback);
 
 void generic_online_page(struct page *page, unsigned int order)
 {
-       kernel_map_pages(page, 1 << order, 1);
+       /*
+        * Freeing the page with debug_pagealloc enabled will try to unmap it,
+        * so we should map it first. This is better than introducing a special
+        * case in page freeing fast path.
+        */
+       if (debug_pagealloc_enabled_static())
+               kernel_map_pages(page, 1 << order, 1);
        __free_pages_core(page, order);
        totalram_pages_add(1UL << order);
 #ifdef CONFIG_HIGHMEM