[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230526075552.363524-2-mcgrof@kernel.org>
Date: Fri, 26 May 2023 00:55:45 -0700
From: Luis Chamberlain <mcgrof@...nel.org>
To: hughd@...gle.com, akpm@...ux-foundation.org, willy@...radead.org,
brauner@...nel.org, djwong@...nel.org
Cc: p.raghav@...sung.com, da.gomez@...sung.com, rohan.puri@...sung.com,
rpuri.linux@...il.com, a.manzanares@...sung.com, dave@...olabs.net,
yosryahmed@...gle.com, keescook@...omium.org, hare@...e.de,
kbusch@...nel.org, mcgrof@...nel.org, patches@...ts.linux.dev,
linux-block@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: [RFC v2 1/8] page_flags: add is_folio_hwpoison()
Provide a helper similar to is_page_hwpoison() for folios
which tests the first head and if the folio is large any page in
the folio is tested for the poison flag.
Signed-off-by: Luis Chamberlain <mcgrof@...nel.org>
---
include/linux/page-flags.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 1c68d67b832f..4d5f395edf03 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -883,6 +883,13 @@ static inline bool is_page_hwpoison(struct page *page)
return PageHuge(page) && PageHWPoison(compound_head(page));
}
+static inline bool is_folio_hwpoison(struct folio *folio)
+{
+ if (folio_test_hwpoison(folio))
+ return true;
+ return folio_test_large(folio) && folio_test_has_hwpoisoned(folio);
+}
+
/*
* For pages that are never mapped to userspace (and aren't PageSlab),
* page_type may be used. Because it is initialised to -1, we invert the
--
2.39.2
Powered by blists - more mailing lists