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

vmscan: convert the activate_locked portion of shrink_page_list to folios

This accounts the number of pages activated correctly for large folios.

Link: https://lkml.kernel.org/r/20220504182857.4013401-14-willy@infradead.orgSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 5441d490
...@@ -1946,15 +1946,16 @@ static unsigned int shrink_page_list(struct list_head *page_list, ...@@ -1946,15 +1946,16 @@ static unsigned int shrink_page_list(struct list_head *page_list,
} }
activate_locked: activate_locked:
/* Not a candidate for swapping, so reclaim swap space. */ /* Not a candidate for swapping, so reclaim swap space. */
if (PageSwapCache(page) && (mem_cgroup_swap_full(page) || if (folio_test_swapcache(folio) &&
PageMlocked(page))) (mem_cgroup_swap_full(&folio->page) ||
try_to_free_swap(page); folio_test_mlocked(folio)))
VM_BUG_ON_PAGE(PageActive(page), page); try_to_free_swap(&folio->page);
if (!PageMlocked(page)) { VM_BUG_ON_FOLIO(folio_test_active(folio), folio);
int type = page_is_file_lru(page); if (!folio_test_mlocked(folio)) {
SetPageActive(page); int type = folio_is_file_lru(folio);
folio_set_active(folio);
stat->nr_activate[type] += nr_pages; stat->nr_activate[type] += nr_pages;
count_memcg_page_event(page, PGACTIVATE); count_memcg_folio_events(folio, PGACTIVATE, nr_pages);
} }
keep_locked: keep_locked:
unlock_page(page); unlock_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