mm/hugetlb.c: fix warning on freeing hwpoisoned hugepage
[~shefty/rdma-dev.git] / mm / hugetlb.c
index e53f39cd67dba964cc9c651d32d82e55e32f5377..22508ef943e6ba841a06f3516a81918b4795301d 100644 (file)
@@ -3172,7 +3172,13 @@ int dequeue_hwpoisoned_huge_page(struct page *hpage)
 
        spin_lock(&hugetlb_lock);
        if (is_hugepage_on_freelist(hpage)) {
-               list_del(&hpage->lru);
+               /*
+                * Hwpoisoned hugepage isn't linked to activelist or freelist,
+                * but dangling hpage->lru can trigger list-debug warnings
+                * (this happens when we call unpoison_memory() on it),
+                * so let it point to itself with list_del_init().
+                */
+               list_del_init(&hpage->lru);
                set_page_refcounted(hpage);
                h->free_huge_pages--;
                h->free_huge_pages_node[nid]--;