We can call it only once instead of twice. Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> --- include/linux/page-flags.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 6ebb573c7195..f1d65a72b378 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -1017,9 +1017,12 @@ static inline bool PageHuge(struct page *page) */ static inline bool is_page_hwpoison(struct page *page) { + struct folio *folio; + if (PageHWPoison(page)) return true; - return PageHuge(page) && PageHWPoison(compound_head(page)); + folio = page_folio(page); + return folio_test_hugetlb(folio) && PageHWPoison(&folio->page); } extern bool is_free_buddy_page(struct page *page); -- 2.43.0