]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
mm/hwpoison-inject: support injecting hwpoison to free page
authorMiaohe Lin <linmiaohe@huawei.com>
Tue, 22 Mar 2022 21:44:35 +0000 (14:44 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 22 Mar 2022 22:57:07 +0000 (15:57 -0700)
memory_failure() can handle free buddy page.  Support injecting hwpoison
to free page by adding is_free_buddy_page check when hwpoison filter is
disabled.

[akpm@linux-foundation.org: export is_free_buddy_page() to modules]

Link: https://lkml.kernel.org/r/20220218092052.3853-1-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Cc: Naoya Horiguchi <naoya.horiguchi@nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/hwpoison-inject.c
mm/page_alloc.c

index aff4d27ec23528466af2443046fa72bb70c5dbcf..f74552977649c81478960caff9409adedad7c04c 100644 (file)
@@ -32,9 +32,9 @@ static int hwpoison_inject(void *data, u64 val)
 
        shake_page(hpage);
        /*
-        * This implies unable to support non-LRU pages.
+        * This implies unable to support non-LRU pages except free page.
         */
-       if (!PageLRU(hpage) && !PageHuge(p))
+       if (!PageLRU(hpage) && !PageHuge(p) && !is_free_buddy_page(p))
                return 0;
 
        /*
index e36d7631a64c191dd9131c1d47b80d062e21bd4a..a573aa9f5160b11b27c3a4327737b47559a82972 100644 (file)
@@ -9417,6 +9417,7 @@ bool is_free_buddy_page(struct page *page)
 
        return order < MAX_ORDER;
 }
+EXPORT_SYMBOL(is_free_buddy_page);
 
 #ifdef CONFIG_MEMORY_FAILURE
 /*