Skip to content

Commit

Permalink
mm: swap: convert mark_page_lazyfree() to folio_mark_lazyfree()
Browse files Browse the repository at this point in the history
mark_page_lazyfree() and the callers are converted to use folio, this
rename and make it to take in a folio argument instead of calling
page_folio().

Link: https://lkml.kernel.org/r/20221209020618.190306-1-wangkefeng.wang@huawei.com
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
Kefeng Wang authored and akpm00 committed Jan 19, 2023
1 parent fc986a3 commit 6a6fe9e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion include/linux/swap.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ extern void lru_add_drain_cpu(int cpu);
extern void lru_add_drain_cpu_zone(struct zone *zone);
extern void lru_add_drain_all(void);
extern void deactivate_page(struct page *page);
extern void mark_page_lazyfree(struct page *page);
void folio_mark_lazyfree(struct folio *folio);
extern void swap_setup(void);

extern void lru_cache_add_inactive_or_unevictable(struct page *page,
Expand Down
2 changes: 1 addition & 1 deletion mm/huge_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -1660,7 +1660,7 @@ bool madvise_free_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
tlb_remove_pmd_tlb_entry(tlb, pmd, addr);
}

mark_page_lazyfree(&folio->page);
folio_mark_lazyfree(folio);
ret = true;
out:
spin_unlock(ptl);
Expand Down
2 changes: 1 addition & 1 deletion mm/madvise.c
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr,
set_pte_at(mm, addr, pte, ptent);
tlb_remove_tlb_entry(tlb, pte, addr);
}
mark_page_lazyfree(&folio->page);
folio_mark_lazyfree(folio);
}
out:
if (nr_swap) {
Expand Down
12 changes: 5 additions & 7 deletions mm/swap.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,16 +757,14 @@ void deactivate_page(struct page *page)
}

/**
* mark_page_lazyfree - make an anon page lazyfree
* @page: page to deactivate
* folio_mark_lazyfree - make an anon folio lazyfree
* @folio: folio to deactivate
*
* mark_page_lazyfree() moves @page to the inactive file list.
* This is done to accelerate the reclaim of @page.
* folio_mark_lazyfree() moves @folio to the inactive file list.
* This is done to accelerate the reclaim of @folio.
*/
void mark_page_lazyfree(struct page *page)
void folio_mark_lazyfree(struct folio *folio)
{
struct folio *folio = page_folio(page);

if (folio_test_lru(folio) && folio_test_anon(folio) &&
folio_test_swapbacked(folio) && !folio_test_swapcache(folio) &&
!folio_test_unevictable(folio)) {
Expand Down

0 comments on commit 6a6fe9e

Please sign in to comment.