mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:46:16 +00:00
mm/khugepaged: page_remove_rmap() -> folio_remove_rmap_pte()
Let's convert __collapse_huge_page_copy_succeeded() and collapse_pte_mapped_thp(). While at it, perform some more folio conversion in __collapse_huge_page_copy_succeeded(). We can get rid of release_pte_page(). Link: https://lkml.kernel.org/r/20231220224504.646757-27-david@redhat.com Signed-off-by: David Hildenbrand <david@redhat.com> Cc: Hugh Dickins <hughd@google.com> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Muchun Song <muchun.song@linux.dev> Cc: Muchun Song <songmuchun@bytedance.com> Cc: Peter Xu <peterx@redhat.com> Cc: Ryan Roberts <ryan.roberts@arm.com> Cc: Yin Fengwei <fengwei.yin@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
a8e61d584e
commit
35668a4321
@ -494,11 +494,6 @@ static void release_pte_folio(struct folio *folio)
|
||||
folio_putback_lru(folio);
|
||||
}
|
||||
|
||||
static void release_pte_page(struct page *page)
|
||||
{
|
||||
release_pte_folio(page_folio(page));
|
||||
}
|
||||
|
||||
static void release_pte_pages(pte_t *pte, pte_t *_pte,
|
||||
struct list_head *compound_pagelist)
|
||||
{
|
||||
@ -687,6 +682,7 @@ static void __collapse_huge_page_copy_succeeded(pte_t *pte,
|
||||
spinlock_t *ptl,
|
||||
struct list_head *compound_pagelist)
|
||||
{
|
||||
struct folio *src_folio;
|
||||
struct page *src_page;
|
||||
struct page *tmp;
|
||||
pte_t *_pte;
|
||||
@ -708,16 +704,17 @@ static void __collapse_huge_page_copy_succeeded(pte_t *pte,
|
||||
}
|
||||
} else {
|
||||
src_page = pte_page(pteval);
|
||||
if (!PageCompound(src_page))
|
||||
release_pte_page(src_page);
|
||||
src_folio = page_folio(src_page);
|
||||
if (!folio_test_large(src_folio))
|
||||
release_pte_folio(src_folio);
|
||||
/*
|
||||
* ptl mostly unnecessary, but preempt has to
|
||||
* be disabled to update the per-cpu stats
|
||||
* inside page_remove_rmap().
|
||||
* inside folio_remove_rmap_pte().
|
||||
*/
|
||||
spin_lock(ptl);
|
||||
ptep_clear(vma->vm_mm, address, _pte);
|
||||
page_remove_rmap(src_page, vma, false);
|
||||
folio_remove_rmap_pte(src_folio, src_page, vma);
|
||||
spin_unlock(ptl);
|
||||
free_page_and_swap_cache(src_page);
|
||||
}
|
||||
@ -1625,7 +1622,7 @@ int collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr,
|
||||
* PTE dirty? Shmem page is already dirty; file is read-only.
|
||||
*/
|
||||
ptep_clear(mm, addr, pte);
|
||||
page_remove_rmap(page, vma, false);
|
||||
folio_remove_rmap_pte(folio, page, vma);
|
||||
nr_ptes++;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user