summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiaohe Lin <linmiaohe@huawei.com>2022-03-22 22:44:35 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2022-03-22 23:57:07 +0100
commita581865ecd0a5a0b8464d6f1e668ae6681c1572f (patch)
tree6048c1370fdd028d364da3997ad30c7b1f584994
parentmm/memory-failure.c: remove unnecessary PageTransTail check (diff)
downloadlinux-a581865ecd0a5a0b8464d6f1e668ae6681c1572f.tar.xz
linux-a581865ecd0a5a0b8464d6f1e668ae6681c1572f.zip
mm/hwpoison-inject: support injecting hwpoison to free page
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>
-rw-r--r--mm/hwpoison-inject.c4
-rw-r--r--mm/page_alloc.c1
2 files changed, 3 insertions, 2 deletions
diff --git a/mm/hwpoison-inject.c b/mm/hwpoison-inject.c
index aff4d27ec235..f74552977649 100644
--- a/mm/hwpoison-inject.c
+++ b/mm/hwpoison-inject.c
@@ -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;
/*
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index e36d7631a64c..a573aa9f5160 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -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
/*