diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2022-02-15 13:44:40 -0500 |
---|---|---|
committer | Matthew Wilcox (Oracle) <willy@infradead.org> | 2022-03-21 13:01:35 -0400 |
commit | d92013d1e5e47fefd02be6920f8470b95b37ce7d (patch) | |
tree | 94b63d2aed3ef863a15d6e3c8decf2dd4e4d5f99 /mm/vmscan.c | |
parent | c79b7b96db8b1240887686720cd149f2c5d979d6 (diff) | |
download | linux-d92013d1e5e47fefd02be6920f8470b95b37ce7d.tar.gz linux-d92013d1e5e47fefd02be6920f8470b95b37ce7d.tar.bz2 linux-d92013d1e5e47fefd02be6920f8470b95b37ce7d.zip |
mm/vmscan: Turn page_check_references() into folio_check_references()
This function only has one caller, and it already has a folio. This
removes a number of calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r-- | mm/vmscan.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c index d57b376593f8..ffdd2bdf17ba 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1383,55 +1383,54 @@ enum page_references { PAGEREF_ACTIVATE, }; -static enum page_references page_check_references(struct page *page, +static enum page_references folio_check_references(struct folio *folio, struct scan_control *sc) { - struct folio *folio = page_folio(page); - int referenced_ptes, referenced_page; + int referenced_ptes, referenced_folio; unsigned long vm_flags; referenced_ptes = folio_referenced(folio, 1, sc->target_mem_cgroup, &vm_flags); - referenced_page = TestClearPageReferenced(page); + referenced_folio = folio_test_clear_referenced(folio); /* - * The supposedly reclaimable page was found to be in a VM_LOCKED vma. - * Let the page, now marked Mlocked, be moved to the unevictable list. + * The supposedly reclaimable folio was found to be in a VM_LOCKED vma. + * Let the folio, now marked Mlocked, be moved to the unevictable list. */ if (vm_flags & VM_LOCKED) return PAGEREF_ACTIVATE; if (referenced_ptes) { /* - * All mapped pages start out with page table + * All mapped folios start out with page table * references from the instantiating fault, so we need - * to look twice if a mapped file page is used more + * to look twice if a mapped file folio is used more * than once. * * Mark it and spare it for another trip around the * inactive list. Another page table reference will * lead to its activation. * - * Note: the mark is set for activated pages as well - * so that recently deactivated but used pages are + * Note: the mark is set for activated folios as well + * so that recently deactivated but used folios are * quickly recovered. */ - SetPageReferenced(page); + folio_set_referenced(folio); - if (referenced_page || referenced_ptes > 1) + if (referenced_folio || referenced_ptes > 1) return PAGEREF_ACTIVATE; /* - * Activate file-backed executable pages after first usage. + * Activate file-backed executable folios after first usage. */ - if ((vm_flags & VM_EXEC) && !PageSwapBacked(page)) + if ((vm_flags & VM_EXEC) && !folio_test_swapbacked(folio)) return PAGEREF_ACTIVATE; return PAGEREF_KEEP; } - /* Reclaim if clean, defer dirty pages to writeback */ - if (referenced_page && !PageSwapBacked(page)) + /* Reclaim if clean, defer dirty folios to writeback */ + if (referenced_folio && !folio_test_swapbacked(folio)) return PAGEREF_RECLAIM_CLEAN; return PAGEREF_RECLAIM; @@ -1671,7 +1670,7 @@ retry: } if (!ignore_references) - references = page_check_references(page, sc); + references = folio_check_references(folio, sc); switch (references) { case PAGEREF_ACTIVATE: |