Message ID | 20240314012506.1600378-3-willy@infradead.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Reliable testing for hugetlb | expand |
On 14.03.24 02:25, Matthew Wilcox (Oracle) wrote: > We can call it only once instead of twice. > > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> > --- > 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); Reviewed-by: David Hildenbrand <david@redhat.com>
On 2024/3/14 9:25, Matthew Wilcox (Oracle) wrote: > We can call it only once instead of twice. > > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Miaohe Lin <linmiaohe@huawei.com> Thanks. > --- > 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); >
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);
We can call it only once instead of twice. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> --- include/linux/page-flags.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)