Skip to contentSkip to conversation

mm-damon-use-damon_get_monitor_folio-for-hugetlb-entries.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Oct 24

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/damon: use damon_get_monitor_folio() for hugetlb entries
has been removed from the -mm tree. Its filename was
mm-damon-use-damon_get_monitor_folio-for-hugetlb-entries.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: Gregory Price <[email protected]>
Subject: mm/damon: use damon_get_monitor_folio() for hugetlb entries
Date: Mon, 5 Oct 2026 23:52:06 -0700

Hugetlb folio acquisition is open-coded in three places:
- damon_hugetlb_mkold()
- damon_young_hugetlb_entry()
- damon_va_probe_hugetlb_entry()

DAMON already has damon_get_monitor_folio(), which paddr uses to get monitored LRU and hugetlb folios and to filter them through damon_folio_acceptable(). These paths bypass that check.

Use that helper in these paths too, so that DAMON acquires hugetlb folios and applies its acceptance policy in one place.

No functional change intended. All callers reach these paths with a present hugetlb PTE under the page table lock, so the folio is always a mapped hugetlb folio and the helper always returns it.

---

 mm/damon/ops-common.c |    6 ++++--
 mm/damon/vaddr.c      |   10 ++++++----
 2 files changed, 10 insertions(+), 6 deletions(-)
mm/damon/ops-common.c renamed from mm/damon/ops-common.c~mm-damon-use-damon_get_monitor_folio-for-hugetlb-entries +4 -2
@@ -140,9 +140,11 @@ void damon_hugetlb_mkold(pte_t *pte, str
 {
 	bool referenced = false;
 	pte_t entry = huge_ptep_get(mm, addr, pte);
-	struct folio *folio = pfn_folio(pte_pfn(entry));
+	struct folio *folio;
 
-	folio_get(folio);
+	folio = damon_get_monitor_folio(pte_pfn(entry));
+	if (!folio)
+		return;
 
 	referenced = damon_hugetlb_ptep_mkold(pte, mm, vma, addr, &entry);
 	if (mmu_notifier_clear_young(mm, addr,
mm/damon/vaddr.c renamed from mm/damon/vaddr.c~mm-damon-use-damon_get_monitor_folio-for-hugetlb-entries +6 -4
@@ -411,8 +411,9 @@ static int damon_young_hugetlb_entry(pte
 	if (!pte_present(entry))
 		goto out;
 
-	folio = pfn_folio(pte_pfn(entry));
-	folio_get(folio);
+	folio = damon_get_monitor_folio(pte_pfn(entry));
+	if (!folio)
+		goto out;
 
 	if (pte_young(entry) || !folio_test_idle(folio) ||
 	    mmu_notifier_test_young(walk->mm, addr))
@@ -660,8 +661,9 @@ static int damon_va_probe_hugetlb_entry(
 	if (!pte_present(entry))
 		goto out;
 
-	folio = pfn_folio(pte_pfn(entry));
-	folio_get(folio);
+	folio = damon_get_monitor_folio(pte_pfn(entry));
+	if (!folio)
+		goto out;
 	damon_va_probe_folio(priv->ctx, priv->r, folio, &entry, NULL,
 			walk->vma->vm_mm);
 	folio_put(folio);

_

Patches currently in -mm which might be from [email protected] are

mm-page_alloc-let-the-highest-memory-node-recover-from-hopeless-state.patch