Commit 8682a7be authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Andrew Morton

mm: remove a call to compound_head() from is_page_hwpoison()

We can call it only once instead of twice.

Link: https://lkml.kernel.org/r/20240321142448.1645400-7-willy@infradead.orgSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
Reviewed-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Oscar Salvador <osalvador@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 85edc15a
...@@ -1065,11 +1065,14 @@ static inline bool PageHuge(const struct page *page) ...@@ -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 * best effort only and inherently racy: there is no way to synchronize with
* failing hardware. * 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)) if (PageHWPoison(page))
return true; 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); extern bool is_free_buddy_page(struct page *page);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment