Skip to content

Commit d92013d

Browse files
author
Matthew Wilcox (Oracle)
committed
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) <[email protected]>
1 parent c79b7b9 commit d92013d

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

mm/vmscan.c

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,55 +1383,54 @@ enum page_references {
13831383
PAGEREF_ACTIVATE,
13841384
};
13851385

1386-
static enum page_references page_check_references(struct page *page,
1386+
static enum page_references folio_check_references(struct folio *folio,
13871387
struct scan_control *sc)
13881388
{
1389-
struct folio *folio = page_folio(page);
1390-
int referenced_ptes, referenced_page;
1389+
int referenced_ptes, referenced_folio;
13911390
unsigned long vm_flags;
13921391

13931392
referenced_ptes = folio_referenced(folio, 1, sc->target_mem_cgroup,
13941393
&vm_flags);
1395-
referenced_page = TestClearPageReferenced(page);
1394+
referenced_folio = folio_test_clear_referenced(folio);
13961395

13971396
/*
1398-
* The supposedly reclaimable page was found to be in a VM_LOCKED vma.
1399-
* Let the page, now marked Mlocked, be moved to the unevictable list.
1397+
* The supposedly reclaimable folio was found to be in a VM_LOCKED vma.
1398+
* Let the folio, now marked Mlocked, be moved to the unevictable list.
14001399
*/
14011400
if (vm_flags & VM_LOCKED)
14021401
return PAGEREF_ACTIVATE;
14031402

14041403
if (referenced_ptes) {
14051404
/*
1406-
* All mapped pages start out with page table
1405+
* All mapped folios start out with page table
14071406
* references from the instantiating fault, so we need
1408-
* to look twice if a mapped file page is used more
1407+
* to look twice if a mapped file folio is used more
14091408
* than once.
14101409
*
14111410
* Mark it and spare it for another trip around the
14121411
* inactive list. Another page table reference will
14131412
* lead to its activation.
14141413
*
1415-
* Note: the mark is set for activated pages as well
1416-
* so that recently deactivated but used pages are
1414+
* Note: the mark is set for activated folios as well
1415+
* so that recently deactivated but used folios are
14171416
* quickly recovered.
14181417
*/
1419-
SetPageReferenced(page);
1418+
folio_set_referenced(folio);
14201419

1421-
if (referenced_page || referenced_ptes > 1)
1420+
if (referenced_folio || referenced_ptes > 1)
14221421
return PAGEREF_ACTIVATE;
14231422

14241423
/*
1425-
* Activate file-backed executable pages after first usage.
1424+
* Activate file-backed executable folios after first usage.
14261425
*/
1427-
if ((vm_flags & VM_EXEC) && !PageSwapBacked(page))
1426+
if ((vm_flags & VM_EXEC) && !folio_test_swapbacked(folio))
14281427
return PAGEREF_ACTIVATE;
14291428

14301429
return PAGEREF_KEEP;
14311430
}
14321431

1433-
/* Reclaim if clean, defer dirty pages to writeback */
1434-
if (referenced_page && !PageSwapBacked(page))
1432+
/* Reclaim if clean, defer dirty folios to writeback */
1433+
if (referenced_folio && !folio_test_swapbacked(folio))
14351434
return PAGEREF_RECLAIM_CLEAN;
14361435

14371436
return PAGEREF_RECLAIM;
@@ -1671,7 +1670,7 @@ static unsigned int shrink_page_list(struct list_head *page_list,
16711670
}
16721671

16731672
if (!ignore_references)
1674-
references = page_check_references(page, sc);
1673+
references = folio_check_references(folio, sc);
16751674

16761675
switch (references) {
16771676
case PAGEREF_ACTIVATE:

0 commit comments

Comments
 (0)