diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2022-09-02 20:46:41 +0100 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2022-10-03 14:02:53 -0700 |
commit | b4e6f66e45b43aed0903731b6c0700573f88282a (patch) | |
tree | 8abe1f0a5a184b18de190eae7b764c62dbd804dd /mm/ksm.c | |
parent | 5fcd079af9ed4e69cca0a2f77c6255d0eb8a8cca (diff) |
ksm: use a folio in replace_page()
Replace three calls to compound_head() with one.
Link: https://lkml.kernel.org/r/20220902194653.1739778-46-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/ksm.c')
-rw-r--r-- | mm/ksm.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1110,6 +1110,7 @@ static int replace_page(struct vm_area_struct *vma, struct page *page, struct page *kpage, pte_t orig_pte) { struct mm_struct *mm = vma->vm_mm; + struct folio *folio; pmd_t *pmd; pmd_t pmde; pte_t *ptep; @@ -1178,10 +1179,11 @@ static int replace_page(struct vm_area_struct *vma, struct page *page, ptep_clear_flush(vma, addr, ptep); set_pte_at_notify(mm, addr, ptep, newpte); + folio = page_folio(page); page_remove_rmap(page, vma, false); - if (!page_mapped(page)) - try_to_free_swap(page); - put_page(page); + if (!folio_mapped(folio)) + folio_free_swap(folio); + folio_put(folio); pte_unmap_unlock(ptep, ptl); err = 0; |