summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJinjiang Tu <tujinjiang@huawei.com>2025-03-18 16:39:38 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-04-20 10:18:18 +0200
commite8defb8b2082cc031342e2a4217d7aa1a36a1fe8 (patch)
treec3a6791d56459d799149d7e39ce3c62a36bb0153 /include
parentbbaec591f62cfc9ebae0ee9e234f52242e535271 (diff)
mm/hwpoison: introduce folio_contain_hwpoisoned_page() helper
commit 5f5ee52d4f58605330b09851273d6e56aaadd29e upstream. Patch series "mm/vmscan: don't try to reclaim hwpoison folio". Fix a bug during memory reclaim if folio is hwpoisoned. This patch (of 2): Introduce helper folio_contain_hwpoisoned_page() to check if the entire folio is hwpoisoned or it contains hwpoisoned pages. Link: https://lkml.kernel.org/r/20250318083939.987651-1-tujinjiang@huawei.com Link: https://lkml.kernel.org/r/20250318083939.987651-2-tujinjiang@huawei.com Signed-off-by: Jinjiang Tu <tujinjiang@huawei.com> Acked-by: Miaohe Lin <linmiaohe@huawei.com> Cc: David Hildenbrand <david@redhat.com> Cc: Kefeng Wang <wangkefeng.wang@huawei.com> Cc: Nanyong Sun <sunnanyong@huawei.com> Cc: Naoya Horiguchi <nao.horiguchi@gmail.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/page-flags.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 691506bdf2c5..27f38932c1c4 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -1113,6 +1113,12 @@ static inline bool is_page_hwpoison(const struct page *page)
return folio_test_hugetlb(folio) && PageHWPoison(&folio->page);
}
+static inline bool folio_contain_hwpoisoned_page(struct folio *folio)
+{
+ return folio_test_hwpoison(folio) ||
+ (folio_test_large(folio) && folio_test_has_hwpoisoned(folio));
+}
+
bool is_free_buddy_page(const struct page *page);
PAGEFLAG(Isolated, isolated, PF_ANY);