* [merged mm-stable] mm-huge_memory-add-folio_mark_accessed-when-zapping-file-thp.patch removed from -mm tree
@ 2025-05-12 0:51 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2025-05-12 0:51 UTC (permalink / raw)
To: mm-commits, ziy, willy, ryan.roberts, osalvador, hannes, david,
21cnbao, baolin.wang, akpm
The quilt patch titled
Subject: mm: huge_memory: add folio_mark_accessed() when zapping file THP
has been removed from the -mm tree. Its filename was
mm-huge_memory-add-folio_mark_accessed-when-zapping-file-thp.patch
This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Baolin Wang <baolin.wang@linux.alibaba.com>
Subject: mm: huge_memory: add folio_mark_accessed() when zapping file THP
Date: Wed, 9 Apr 2025 17:38:58 +0800
When investigating performance issues during file folio unmap, I noticed
some behavioral differences in handling non-PMD-sized folios and PMD-sized
folios. For non-PMD-sized file folios, it will call folio_mark_accessed()
to mark the folio as having seen activity, but this is not done for
PMD-sized folios.
This might not cause obvious issues, but a potential problem could be
that, it might lead to reclaim of hot file folios under memory pressure,
as quoted from Johannes:
: Sometimes file contents are only accessed through relatively short-lived
: mappings. But they can nevertheless be accessed a lot and be hot. It's
: important to not lose that information on unmap, and end up kicking out a
: frequently used cache page.
Therefore, we should also add folio_mark_accessed() for PMD-sized file
folios when unmapping.
[baolin.wang@linux.alibaba.com: add comment]
Link: https://lkml.kernel.org/r/23fdc11d-e983-4627-89a8-79e9ecf9a45a@linux.alibaba.com
Link: https://lkml.kernel.org/r/fc117f60d7b686f87067f36a0ef7cdbc3a78109c.1744190345.git.baolin.wang@linux.alibaba.com
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Zi Yan <ziy@nvidia.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Cc: Barry Song <21cnbao@gmail.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/huge_memory.c | 8 ++++++++
1 file changed, 8 insertions(+)
--- a/mm/huge_memory.c~mm-huge_memory-add-folio_mark_accessed-when-zapping-file-thp
+++ a/mm/huge_memory.c
@@ -2259,6 +2259,14 @@ int zap_huge_pmd(struct mmu_gather *tlb,
zap_deposited_table(tlb->mm, pmd);
add_mm_counter(tlb->mm, mm_counter_file(folio),
-HPAGE_PMD_NR);
+
+ /*
+ * Use flush_needed to indicate whether the PMD entry
+ * is present, instead of checking pmd_present() again.
+ */
+ if (flush_needed && pmd_young(orig_pmd) &&
+ likely(vma_has_recency(vma)))
+ folio_mark_accessed(folio);
}
spin_unlock(ptl);
_
Patches currently in -mm which might be from baolin.wang@linux.alibaba.com are
mm-khugepaged-convert-set_huge_pmd-to-take-a-folio.patch
mm-convert-do_set_pmd-to-take-a-folio.patch
mm-mincore-use-pte_batch_bint-to-batch-process-large-folios.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-05-12 0:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-12 0:51 [merged mm-stable] mm-huge_memory-add-folio_mark_accessed-when-zapping-file-thp.patch removed from -mm tree Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.