On 3/21/24 15:24, Matthew Wilcox (Oracle) wrote: > We can call it only once instead of twice. > > Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> > Reviewed-by: David Hildenbrand <david@xxxxxxxxxx> > Reviewed-by: Miaohe Lin <linmiaohe@xxxxxxxxxx> Acked-by: Vlastimil Babka <vbabka@xxxxxxx> > --- > include/linux/page-flags.h | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h > index 6fb3cd42ee59..94eb8a11a321 100644 > --- a/include/linux/page-flags.h > +++ b/include/linux/page-flags.h > @@ -1065,11 +1065,14 @@ static inline bool PageHuge(const struct page *page) > * best effort only and inherently racy: there is no way to synchronize with > * failing hardware. > */ > -static inline bool is_page_hwpoison(struct page *page) > +static inline bool is_page_hwpoison(const struct page *page) > { > + const 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);