lkml.org 
[lkml]   [2023]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC v2 1/8] page_flags: add is_folio_hwpoison()
Date
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@kernel.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
\
 
 \ /
  Last update: 2023-05-26 09:57    [W:0.168 / U:0.460 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site