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

proc: use pfn_swap_entry_folio where obvious

These callers only pass the result to PageAnon(), so we can save the extra
call to compound_head() by using pfn_swap_entry_folio().

Link: https://lkml.kernel.org/r/20240111152429.3374566-3-willy@infradead.orgSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 5662400a
...@@ -1807,7 +1807,7 @@ static unsigned long pagemap_page_category(struct pagemap_scan_private *p, ...@@ -1807,7 +1807,7 @@ static unsigned long pagemap_page_category(struct pagemap_scan_private *p,
if (p->masks_of_interest & PAGE_IS_FILE) { if (p->masks_of_interest & PAGE_IS_FILE) {
swp = pte_to_swp_entry(pte); swp = pte_to_swp_entry(pte);
if (is_pfn_swap_entry(swp) && if (is_pfn_swap_entry(swp) &&
!PageAnon(pfn_swap_entry_to_page(swp))) !folio_test_anon(pfn_swap_entry_folio(swp)))
categories |= PAGE_IS_FILE; categories |= PAGE_IS_FILE;
} }
if (pte_swp_soft_dirty(pte)) if (pte_swp_soft_dirty(pte))
...@@ -1873,7 +1873,7 @@ static unsigned long pagemap_thp_category(struct pagemap_scan_private *p, ...@@ -1873,7 +1873,7 @@ static unsigned long pagemap_thp_category(struct pagemap_scan_private *p,
if (p->masks_of_interest & PAGE_IS_FILE) { if (p->masks_of_interest & PAGE_IS_FILE) {
swp = pmd_to_swp_entry(pmd); swp = pmd_to_swp_entry(pmd);
if (is_pfn_swap_entry(swp) && if (is_pfn_swap_entry(swp) &&
!PageAnon(pfn_swap_entry_to_page(swp))) !folio_test_anon(pfn_swap_entry_folio(swp)))
categories |= PAGE_IS_FILE; categories |= PAGE_IS_FILE;
} }
} }
......
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