Re: [PATCH v8 3/3] mm/vmscan: avoid split lazyfree THP during shrink_folio_list()
From: Lance Yang
Date: Sat Jun 22 2024 - 06:01:41 EST
Hi Andrew,
I made some minor changes suggested by David[1]. Could you please fold the
following changes into this patch?
[1] https://lore.kernel.org/linux-mm/e7c0aff1-b690-4926-9a34-4e32c9f3faaa@xxxxxxxxxx/
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 4b2817bb2c7d..0cb52ae29259 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2693,21 +2693,11 @@ static bool __discard_anon_folio_pmd_locked(struct vm_area_struct *vma,
unsigned long addr, pmd_t *pmdp,
struct folio *folio)
{
- VM_WARN_ON_FOLIO(folio_test_swapbacked(folio), folio);
- VM_WARN_ON_FOLIO(!folio_test_anon(folio), folio);
-
struct mm_struct *mm = vma->vm_mm;
int ref_count, map_count;
pmd_t orig_pmd = *pmdp;
struct page *page;
- if (unlikely(!pmd_present(orig_pmd) || !pmd_trans_huge(orig_pmd)))
- return false;
-
- page = pmd_page(orig_pmd);
- if (unlikely(page_folio(page) != folio))
- return false;
-
if (folio_test_dirty(folio) || pmd_dirty(orig_pmd))
return false;
diff --git a/mm/rmap.c b/mm/rmap.c
index df1a43295c85..b358501fb7e8 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1678,9 +1678,8 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma,
if (flags & TTU_SPLIT_HUGE_PMD) {
/*
- * We temporarily have to drop the PTL and start
- * once again from that now-PTE-mapped page
- * table.
+ * We temporarily have to drop the PTL and
+ * restart so we can process the PTE-mapped THP.
*/
split_huge_pmd_locked(vma, pvmw.address,
pvmw.pmd, false, folio);
--
Thanks,
Lance