mm/damon/vaddr: support {prep,apply}_probes
Subsystems (2)
SJ Park
maintainercover mm/damon/vaddr: support {prep,apply}_probes
DAMON supports data attributes monitoring. However, only the physical address space operation set (paddr) is supporting it. Add the support to the virtual address space operation set (vaddr).
Patch 1 adds prep_probes support to vaddr. Patch 2 moves probe filter handling code in paddr.c that can be reused by vaddr to ops-common.c. Patch 3 adds minimum apply_probes support to vaddr. Patch 4 extends the support for hugetlb. Patch 5 extends the support for pgidle_unset filter.
Test
====
I confirmed it can capture ~48 mb working set of masim in vaddr mode, like below.
First, start masim [1] to access ~48 mb memory at a time, in the background.
$ ./masim/masim.py run \
--config_file ./masim/configs/stairs-50mb.cfg \
--repeat 10 --quiet &Note that the config says the working set is 50mb. It is 50 million bytes, so ~48 MiB.
Start traditional access monitoring of masim's virtual address space using damo [2].
$ sudo ./damo/damo start $(pidof masim)
Confirm it can capture the ~48 MiB working set as the 4-th region on the snapshot.
$ sudo ./damo/damo report access
heatmap:
11111111334[...]3000000000000000000000000000000000000000489999997777777743333333555556[...]8
# min/max temperatures: -1,150,000,000, 80,009,499, column size: 6.963
MiB
intervals: sample 5 ms aggr 100 ms (max access hz 200)
0 addr 85.355 TiB size 55.703 MiB access 0 hz age 9.500 s
1 addr 85.355 TiB size 18.984 MiB access 0 hz age 6.700 s
2 addr 127.183 TiB size 278.516 MiB access 0 hz age 11.500 s
3 addr 127.183 TiB size 7.570 MiB access 0 hz age 900 ms
4 addr 127.183 TiB size 48.133 MiB access 190 hz age 800 ms
5 addr 127.183 TiB size 54.977 MiB access 0 hz age 1.700 s
6 addr 127.183 TiB size 55.113 MiB access 0 hz age 6.700 s
7 addr 127.183 TiB size 37.902 MiB access 0 hz age 3.900 s
8 addr 127.990 TiB size 120.000 KiB access 0 hz age 11.400 s
9 addr 127.990 TiB size 8.000 KiB access 70 hz age 0 ns
10 addr 127.990 TiB size 4.000 KiB access 0 hz age 11.200 s
memory bw estimate: 8.931 GiB per second
total size: 557.027 MiB
record DAMON intervals: sample 5 ms, aggr 100 msStop access monitoring and start probe-only mode access monitoring.
$ sudo ./damo/damo stop
$ sudo ./damo/damo start $(pidof masim) --probe_prep set_pgidle \
--probe_filter allow pgidle_unset --probe_weight 1Confirm it can also capture the ~48 MiB working set as the 11-th region on the snapshot.
$ sudo ./damo/damo report attrs
heatmap:
00000000113[...]40000000000000000000000000000000000000000000000001111114999999533333336[...]6
# min/max temperatures: -840,000,000, 330,002,000, column size: 6.961
MiB
probe prep: set_pgidle, filter: allow pgidle_unset (weight: 1)
intervals: sample 5 ms aggr 100 ms (max probe hits 20)
# size address age probe_hits
0 8.000 KiB 127.990 TiB 8.700 s 0
1 120.000 KiB 127.990 TiB 8.600 s 0
2 55.543 MiB 127.183 TiB 8.400 s 0
3 110.008 MiB 127.183 TiB 8.300 s 0
4 55.352 MiB 127.183 TiB 8.100 s 0
5 55.605 MiB 127.183 TiB 8 s 0
6 55.691 MiB 85.355 TiB 7.900 s 0
7 54.430 MiB 127.183 TiB 7.900 s 0
8 50.391 MiB 127.183 TiB 6.900 s 0
9 18.879 MiB 85.355 TiB 6 s 0
10 52.844 MiB 127.183 TiB 3.500 s 0
11 48.039 MiB 127.183 TiB 3.300 s 20
12 4.000 KiB 127.990 TiB 8.500 s 20
memory bw estimate: 0 B per second
total size: 556.910 MiB
record DAMON intervals: sample 5 ms, aggr 100 ms[1] https://github.com/sjp38/masim
[2] https://github.com/damonitor/damo
Changes from v1 original post
- v1: https://lore.kernel.org/[email protected]
- Rebase to latest mm-new.
Changes from RFC
- RFC: https://lore.kernel.org/[email protected]
- Drop RFC tag.
- Rebase to latest mm-new.
SJ Park (5):
mm/damon/vaddr: support prep_probes mm/damon/paddr: move probe filter handling to ops-common mm/damon/vaddr: support apply_probe mm/damon/vaddr: extend apply_probes() for hugetlb mm/damon/vaddr: support pgidle_unset probe filter type
mm/damon/ops-common.c | 32 ++++++ mm/damon/ops-common.h | 2 + mm/damon/paddr.c | 23 +---- mm/damon/vaddr.c | 232 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 267 insertions(+), 22 deletions(-)
base-commit: da659d141e9797b3a2e5d0e2b457bfa4e8a8cb2d
Signature · 1 line
2.47.3
SJ Park
maintainerPATCH 1/5 mm/damon/vaddr: support prep_probes
DAMON virtual address space operation set (vaddr) is not supporting prep_probes. Add the support.
--- mm/damon/vaddr.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
mm/damon/vaddr.c +40 -0
@@ -483,6 +483,45 @@ static unsigned int damon_va_check_accesses(struct damon_ctx *ctx)return max_nr_accesses; } +static void damon_va_prep_probe_region (struct damon_ctx *ctx, +struct mm_struct *mm,struct damon_region *r, +struct damon_probe *probe) +{ +struct damon_prep *p; + +damon_for_each_prep (p, probe) { +switch (p->action) { +case DAMON_PREP_SET_PGIDLE : +damon_va_mkold (mm, r->sampling_addr); +break ; +default : +break ; + } + } +} + +static void damon_va_prep_probes (struct damon_ctx *ctx,bool set_samples) +{ +struct damon_target *t; +struct mm_struct *mm; +struct damon_region *r; +struct damon_probe *p; + +damon_for_each_target (t, ctx) { + mm =damon_get_mm (t); +if (!mm) +continue ; +damon_for_each_region (r, t) { +if (set_samples) + r->sampling_addr =damon_rand (ctx, r->ar.start, + r->ar.end); +damon_for_each_probe (p, ctx) +damon_va_prep_probe_region (ctx, mm, r, p); + } +mmput (mm); + } +} +static bool damos_va_filter_young_match (struct damos_filter *filter,struct folio *folio,struct vm_area_struct *vma,unsigned long addr,pte_t *ptep,pmd_t *pmdp)
@@ -911,6 +950,7 @@ static int __init damon_va_initcall(void) .update = damon_va_update, .prepare_access_checks = damon_va_prepare_access_checks, .check_accesses = damon_va_check_accesses, + .prep_probes = damon_va_prep_probes, .target_valid = damon_va_target_valid, .cleanup_target = damon_va_cleanup_target, .apply_scheme = damon_va_apply_scheme,
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [PATCH REPOST 1/5] mm/damon/vaddr: support prep_probes
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 4 lines
DAMON virtual address space operation set (vaddr) is not supporting
prep_probes. Add the support.Signed-off-by SJ Park <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: [PATCH REPOST 1/5] mm/damon/vaddr: support prep_probes
In reply to SJ ParkQuoted 2 lines · SJ Park
DAMON virtual address space operation set (vaddr) is not supporting
prep_probes. Add the support.
This looks good to me. Reusing the region's sampling address and the existing damon_va_mkold() path keeps probe preparation consistent with vaddr access monitoring.
Thanks,
Lian
SJ Park
maintainerPATCH 2/5 mm/damon/paddr: move probe filter handling to ops-common
In reply to SJ ParkProbe filter matching logic for anon and memcg type filters in DAMON's physical address space operation set (paddr) can be reused by virtual address space operation set (vaddr) in future. Prepare the future by moving the code to ops-common.c
--- mm/damon/ops-common.c | 32 ++++++++++++++++++++++++++++++++ mm/damon/ops-common.h | 2 ++ mm/damon/paddr.c | 23 +---------------------- 3 files changed, 35 insertions(+), 22 deletions(-)
mm/damon/ops-common.c +32 -0
@@ -531,3 +531,35 @@ bool damos_ops_has_filter(struct damos *s)return true;return false; } + +bool damon_ops_filter_match (struct damon_filter *filter,struct folio *folio) +{ +bool matched = false; +struct mem_cgroup *memcg; + +switch (filter->type) { +case DAMON_FILTER_TYPE_ANON : +if (!folio) { + matched = false; +break ; + } + matched =folio_test_anon (folio); +break ; +case DAMON_FILTER_TYPE_MEMCG : +if (!folio) { + matched = false; +break ; + } +rcu_read_lock (); + memcg =folio_memcg_check (folio); +if (!memcg) + matched = false; +else + matched = filter->memcg_id ==mem_cgroup_id (memcg); +rcu_read_unlock (); +break ; +default : +break ; + } +return matched == filter->matching; +}
mm/damon/ops-common.h +2 -0
@@ -31,3 +31,5 @@ bool damos_folio_filter_match(struct damos_filter *filter, struct folio *folio);unsigned long damon_migrate_pages (struct list_head *folio_list,int target_nid);bool damos_ops_has_filter (struct damos *s); + +bool damon_ops_filter_match (struct damon_filter *filter,struct folio *folio);
mm/damon/paddr.c +1 -22
@@ -143,29 +143,8 @@ static bool damon_pa_filter_match(struct damon_filter *filter, struct folio *folio) {bool matched = false; -struct mem_cgroup *memcg;switch (filter->type) { -case DAMON_FILTER_TYPE_ANON : -if (!folio) { - matched = false; -break ; - } - matched =folio_test_anon (folio); -break ; -case DAMON_FILTER_TYPE_MEMCG : -if (!folio) { - matched = false; -break ; - } -rcu_read_lock (); - memcg =folio_memcg_check (folio); -if (!memcg) - matched = false; -else - matched = filter->memcg_id ==mem_cgroup_id (memcg); -rcu_read_unlock (); -break ;case DAMON_FILTER_TYPE_PGIDLE_UNSET :if (!folio) matched = false;
@@ -173,7 +152,7 @@ static bool damon_pa_filter_match(struct damon_filter *filter, matched =damon_folio_young (folio);break ;default : -break ; +return damon_ops_filter_match (filter, folio); }return matched == filter->matching; }
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [PATCH REPOST 2/5] mm/damon/paddr: move probe filter handling to ops-common
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 6 lines
Probe filter matching logic for anon and memcg type filters in DAMON's physical address space operation set (paddr) can be reused by virtual address space operation set (vaddr) in future. Prepare the future by moving the code to
ops-common.cSigned-off-by SJ Park <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH REPOST 2/5] mm/damon/paddr: move probe filter handling to ops-common
In reply to SJ ParkQuoted 4 lines · SJ Park
Probe filter matching logic for anon and memcg type filters in DAMON's physical address space operation set (paddr) can be reused by virtual address space operation set (vaddr) in future. Prepare the future by moving the code to
ops-common.c
Nice cleanup. Moving the common anon and memcg matching to ops-common preserves the existing paddr behavior and makes the logic reusable by vaddr.
Thanks,
Lian
SJ Park
maintainerPATCH 3/5 mm/damon/vaddr: support apply_probe
In reply to SJ ParkDAMON virtual address space operation set (vaddr) is not supporting apply_probe. Add a minimum support. Do not support hugetlb pages and PGIDLE_UNSET filter type for simplicity.
--- mm/damon/vaddr.c | 123 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+)
mm/damon/vaddr.c +123 -0
@@ -522,6 +522,128 @@ static void damon_va_prep_probes(struct damon_ctx *ctx, bool set_samples) } } +static bool damon_va_filter_pass (struct folio *folio,struct damon_probe *p) +{ +struct damon_filter *f; +bool pass = true; + +damon_for_each_filter (f, p) { +if (damon_ops_filter_match (f, folio)) { + pass = f->allow; +break ; + } + pass = !f->allow; + } +return pass; +} + +struct damon_va_probe_walk_private { +struct damon_ctx *ctx; +struct damon_region *r; +}; + +static void damon_va_probe_folio (struct damon_ctx *ctx, +struct damon_region *r,struct folio *folio) +{ +struct damon_probe *probe; +int i =0 ; + +damon_for_each_probe (probe, ctx) { +if (damon_va_filter_pass (folio, probe)) + r->probe_hits[i]++; + i++; + } +} + +static int damon_va_probe_pmd_entry (pmd_t *pmd,unsigned long addr, +unsigned long next,struct mm_walk *walk) +{ +pte_t *pte; +pte_t ptent; +spinlock_t *ptl; +struct folio *folio; +struct damon_va_probe_walk_private *priv = walk->private; + +#ifdef CONFIG_TRANSPARENT_HUGEPAGE + ptl =pmd_trans_huge_lock (pmd, walk->vma); +if (ptl) { +pmd_t pmde =pmdp_get (pmd); + +if (!pmd_present (pmde)) + goto huge_out; + folio =vm_normal_folio_pmd (walk->vma, addr, pmde); +if (!folio) + goto huge_out; +damon_va_probe_folio (priv->ctx, priv->r, folio); + +huge_out: +spin_unlock (ptl); +return 0 ; + } +#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ + + pte =pte_offset_map_lock (walk->mm, pmd, addr, &ptl); +if (!pte) +return 0 ; + ptent =ptep_get (pte); +if (!pte_present (ptent)) + goto out; + folio =vm_normal_folio (walk->vma, addr, ptent); +if (!folio) + goto out; +damon_va_probe_folio (priv->ctx, priv->r, folio); + +out: +pte_unmap_unlock (pte, ptl); +return 0 ; +} + +static void __damon_va_apply_probes (struct damon_ctx *ctx, +struct mm_struct *mm,struct damon_region *r) +{ +struct damon_va_probe_walk_private arg = { + .ctx = ctx, + .r = r, + }; +struct mm_walk_ops damon_probe_walk_ops = { + .pmd_entry = damon_va_probe_pmd_entry, + .hugetlb_entry =NULL , + }; +unsigned long addr = r->sampling_addr; + +if (!mm) +return ; + +damon_va_walk_page_range (mm, addr, addr +1 , &damon_probe_walk_ops, + &arg); +} + +static unsigned int damon_va_apply_probes (struct damon_ctx *ctx, +bool set_samples,bool return_max_wsum) +{ +struct damon_target *t; +struct mm_struct *mm; +struct damon_region *r; +unsigned int max_wsum =0 ; + +damon_for_each_target (t, ctx) { + mm =damon_get_mm (t); +damon_for_each_region (r, t) { +if (set_samples) + r->sampling_addr =damon_rand (ctx, r->ar.start, + r->ar.end); +__damon_va_apply_probes (ctx, mm, r); +if (return_max_wsum) + max_wsum =max (damon_probe_hits_wsum (r, false, + ctx), max_wsum); + } +if (mm) +mmput (mm); + } + +return max_wsum; +} +static bool damos_va_filter_young_match (struct damos_filter *filter,struct folio *folio,struct vm_area_struct *vma,unsigned long addr,pte_t *ptep,pmd_t *pmdp)
@@ -951,6 +1073,7 @@ static int __init damon_va_initcall(void) .prepare_access_checks = damon_va_prepare_access_checks, .check_accesses = damon_va_check_accesses, .prep_probes = damon_va_prep_probes, + .apply_probes = damon_va_apply_probes, .target_valid = damon_va_target_valid, .cleanup_target = damon_va_cleanup_target, .apply_scheme = damon_va_apply_scheme,
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [PATCH REPOST 3/5] mm/damon/vaddr: support apply_probe
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 5 lines
DAMON virtual address space operation set (vaddr) is not supporting
apply_probe. Add a minimum support. Do not support hugetlb pages andPGIDLE_UNSETfilter type for simplicity.Signed-off-by SJ Park <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
SJ Park
maintainerPATCH 4/5 mm/damon/vaddr: extend apply_probes() for hugetlb
In reply to SJ ParkDAMON virtual address space operation set(vaddr) does not support hugetlb pages in apply_probes. Extend it for hugetlb pages.
--- mm/damon/vaddr.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-)
mm/damon/vaddr.c +29 -1
@@ -598,6 +598,34 @@ static int damon_va_probe_pmd_entry(pmd_t *pmd, unsigned long addr,return 0 ; } +#ifdef CONFIG_HUGETLB_PAGE +static int damon_va_probe_hugetlb_entry (pte_t *pte,unsigned long hmask, +unsigned long addr,unsigned long end,struct mm_walk *walk) +{ +struct damon_va_probe_walk_private *priv = walk->private; +struct hstate *h =hstate_vma (walk->vma); +struct folio *folio; +spinlock_t *ptl; +pte_t entry; + + ptl =huge_pte_lock (h, walk->mm, pte); + entry =huge_ptep_get (walk->mm, addr, pte); +if (!pte_present (entry)) + goto out; + + folio =pfn_folio (pte_pfn (entry)); +folio_get (folio); +damon_va_probe_folio (priv->ctx, priv->r, folio); +folio_put (folio); + +out: +spin_unlock (ptl); +return 0 ; +} +#else +#define damon_va_probe_hugetlb_entry NULL +#endif /* CONFIG_HUGETLB_PAGE */ +static void __damon_va_apply_probes (struct damon_ctx *ctx,struct mm_struct *mm,struct damon_region *r) {
@@ -607,7 +635,7 @@ static void __damon_va_apply_probes(struct damon_ctx *ctx, };struct mm_walk_ops damon_probe_walk_ops = { .pmd_entry = damon_va_probe_pmd_entry, - .hugetlb_entry =NULL , + .hugetlb_entry = damon_va_probe_hugetlb_entry, };unsigned long addr = r->sampling_addr;
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [PATCH REPOST 4/5] mm/damon/vaddr: extend apply_probes() for hugetlb
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 4 lines
DAMON virtual address space operation set(vaddr) does not support hugetlb pages in
apply_probes. Extend it for hugetlb pages.Signed-off-by SJ Park <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
Re: [PATCH REPOST 4/5] mm/damon/vaddr: extend apply_probes() for hugetlb
In reply to SJ ParkQuoted 2 lines · SJ Park
DAMON virtual address space operation set(vaddr) does not support hugetlb pages in
apply_probes. Extend it for hugetlb pages.
This looks good to me. The new callback follows the existing vaddr hugetlb walk, takes the huge PTE lock, and keeps a folio reference while the probes inspect it.
Thanks,
Lian
Re: [PATCH REPOST 4/5] mm/damon/vaddr: extend apply_probes() for hugetlb
In reply to SJ ParkQuoted 59 lines · On Wed, 9 Sep 2026 07:04:06 -0700 SJ Park <[email protected]> wrote:
DAMON virtual address space operation set(vaddr) does not support hugetlb pages in
apply_probes. Extend it for hugetlb pages.Signed-off-by SJ Park <[email protected]>--- mm/damon/vaddr.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-)mm/damon/vaddr.c +29
-1@@ -598,6 +598,34 @@ static int damon_va_probe_pmd_entry(pmd_t *pmd, unsigned long addr,return 0 ; } +#ifdef CONFIG_HUGETLB_PAGE +static int damon_va_probe_hugetlb_entry (pte_t *pte,unsigned long hmask, +unsigned long addr,unsigned long end,struct mm_walk *walk) +{ +struct damon_va_probe_walk_private *priv = walk->private; +struct hstate *h =hstate_vma (walk->vma); +struct folio *folio; +spinlock_t *ptl; +pte_t entry; + + ptl =huge_pte_lock (h, walk->mm, pte); + entry =huge_ptep_get (walk->mm, addr, pte); +if (!pte_present (entry)) + goto out; + + folio =pfn_folio (pte_pfn (entry)); +folio_get (folio); +damon_va_probe_folio (priv->ctx, priv->r, folio); +folio_put (folio); + +out: +spin_unlock (ptl); +return 0 ; +} +#else +#define damon_va_probe_hugetlb_entry NULL +#endif /* CONFIG_HUGETLB_PAGE */ +static void __damon_va_apply_probes (struct damon_ctx *ctx,struct mm_struct *mm,struct damon_region *r) {@@ -607,7 +635,7 @@ static void __damon_va_apply_probes(struct damon_ctx *ctx, };struct mm_walk_ops damon_probe_walk_ops = { .pmd_entry = damon_va_probe_pmd_entry, - .hugetlb_entry =NULL , + .hugetlb_entry = damon_va_probe_hugetlb_entry, };unsigned long addr = r->sampling_addr;Signature · 1 line
2.47.3
Hi SJ,
Reviewed patches 1-4, with particular attention to the vaddr prep/apply flow, the filter handling shared with paddr, and the hugetlb page-walk path. The changes look consistent with the existing DAMON interfaces and page-walk semantics.
Thanks,
Kunwu
Sent using hkml (https://github.com/sjp38/hackermail)
SJ Park
maintainerPATCH 5/5 mm/damon/vaddr: support pgidle_unset probe filter type
In reply to SJ ParkDAMON virtual address space operation set (vaddr) does not support pgidle_unset probe filter type. Add the support.
--- mm/damon/vaddr.c | 55 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 7 deletions(-)
mm/damon/vaddr.c +48 -7
@@ -522,13 +522,49 @@ static void damon_va_prep_probes(struct damon_ctx *ctx, bool set_samples) } } -static bool damon_va_filter_pass (struct folio *folio,struct damon_probe *p) +static bool damon_va_young_addr (struct folio *folio,pte_t *pte,pmd_t *pmd, +struct mm_struct *mm,unsigned long addr) +{ +bool young = false; + +if (pte) + young =pte_young (*pte); +else if (pmd) + young =pmd_young (*pmd); + young = young || !folio_test_idle (folio) || +mmu_notifier_test_young (mm, addr); +return young; +} + +static bool damon_va_filter_match (struct damon_filter *filter, +struct folio *folio,pte_t *pte,pmd_t *pmd, +struct mm_struct *mm,unsigned long addr) +{ +bool matched = false; + +switch (filter->type) { +case DAMON_FILTER_TYPE_PGIDLE_UNSET : +if (!folio) + matched = false; +else + matched =damon_va_young_addr (folio, pte, pmd, mm, + addr); +break ; +default : +return damon_ops_filter_match (filter, folio); + } +return matched == filter->matching; +} + +static bool damon_va_filter_pass (struct folio *folio,struct damon_probe *p, +pte_t *pte,pmd_t *pmd,struct mm_struct *mm, +unsigned long addr) {struct damon_filter *f;bool pass = true;damon_for_each_filter (f, p) { -if (damon_ops_filter_match (f, folio)) { +if (damon_va_filter_match (f, folio, pte, pmd, mm, addr)) { pass = f->allow;break ; }
@@ -543,13 +579,15 @@ struct damon_va_probe_walk_private { };static void damon_va_probe_folio (struct damon_ctx *ctx, -struct damon_region *r,struct folio *folio) +struct damon_region *r,struct folio *folio, +pte_t *pte,pmd_t *pmd,struct mm_struct *mm) {struct damon_probe *probe;int i =0 ;damon_for_each_probe (probe, ctx) { -if (damon_va_filter_pass (folio, probe)) +if (damon_va_filter_pass (folio, probe, pte, pmd, mm, + r->sampling_addr)) r->probe_hits[i]++; i++; }
@@ -574,7 +612,8 @@ static int damon_va_probe_pmd_entry(pmd_t *pmd, unsigned long addr, folio =vm_normal_folio_pmd (walk->vma, addr, pmde);if (!folio) goto huge_out; -damon_va_probe_folio (priv->ctx, priv->r, folio); +damon_va_probe_folio (priv->ctx, priv->r, folio,NULL , &pmde, + walk->vma->vm_mm); huge_out:spin_unlock (ptl);
@@ -591,7 +630,8 @@ static int damon_va_probe_pmd_entry(pmd_t *pmd, unsigned long addr, folio =vm_normal_folio (walk->vma, addr, ptent);if (!folio) goto out; -damon_va_probe_folio (priv->ctx, priv->r, folio); +damon_va_probe_folio (priv->ctx, priv->r, folio, &ptent,NULL , + walk->vma->vm_mm); out:pte_unmap_unlock (pte, ptl);
@@ -615,7 +655,8 @@ static int damon_va_probe_hugetlb_entry(pte_t *pte, unsigned long hmask, folio =pfn_folio (pte_pfn (entry));folio_get (folio); -damon_va_probe_folio (priv->ctx, priv->r, folio); +damon_va_probe_folio (priv->ctx, priv->r, folio, &entry,NULL , + walk->vma->vm_mm);folio_put (folio); out:
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [PATCH REPOST 5/5] mm/damon/vaddr: support pgidle_unset probe filter type
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 4 lines
DAMON virtual address space operation set (vaddr) does not support
pgidle_unsetprobe filter type. Add the support.Signed-off-by SJ Park <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
Re: [PATCH REPOST 5/5] mm/damon/vaddr: support pgidle_unset probe filter type
In reply to SJ ParkQuoted 2 lines · SJ Park
DAMON virtual address space operation set (vaddr) does not support
pgidle_unsetprobe filter type. Add the support.
This looks good to me. Checking the PTE or PMD young state together with the folio idle flag and MMU notifier state follows the existing vaddr access-checking model while making it available to probes.
Thanks,
Lian
SJ Park
maintainerRe: [PATCH REPOST 5/5] mm/damon/vaddr: support pgidle_unset probe filter type
Quoted 9 lines · On Fri, 11 Sep 2026 10:01:10 +0800 Lian Wang <[email protected]> wrote:
Quoted 2 lines · SJ Park
DAMON virtual address space operation set (vaddr) does not support
pgidle_unsetprobe filter type. Add the support.This looks good to me. Checking the PTE or PMD young state together with the folio idle flag and MMU notifier state follows the existing vaddr access-checking model while making it available to probes.
Reviewed-by Lian Wang <[email protected]>
Thank you for your nice reviews Lian!
Thanks,
SJ
[...]
Re: [PATCH REPOST 5/5] mm/damon/vaddr: support pgidle_unset probe filter type
In reply to SJ ParkQuoted 16 lines · On Wed, 9 Sep 2026 07:04:07 -0700 SJ Park <[email protected]> wrote:
DAMON virtual address space operation set (vaddr) does not support
pgidle_unsetprobe filter type. Add the support.Signed-off-by SJ Park <[email protected]>--- mm/damon/vaddr.c | 55 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 7 deletions(-)mm/damon/vaddr.c +0
-0@@ -522,13 +522,49 @@ static void damon_va_prep_probes(struct damon_ctx *ctx, bool set_samples) } }
mm/damon/vaddr.c static void damon_va_prep_probes(struct damon_ctx *ctx, bool set_samples) · line 533
Quoted 10 lines
mm/damon/vaddr.c +9
-1-static bool damon_va_filter_pass (struct folio *folio,struct damon_probe *p) +static bool damon_va_young_addr (struct folio *folio,pte_t *pte,pmd_t *pmd, +struct mm_struct *mm,unsigned long addr) +{ +bool young = false; + +if (pte) + young =pte_young (*pte); +else if (pmd) + young =pmd_young (*pmd);
Hi SJ,
I see that all callers already check pte_present() / pmd_present() before calling this helper, so I don't see a correctness issue here.
However, the other DAMON young/accessed helpers, such as damon_pte_young(), damon_hugetlb_young(), and the PMD path in damon_folio_young_one(), keep the present check together with the young check.
Would it make sense to keep the same check here for consistency?
Thanks,
Kunwu
Quoted 89 lines
mm/damon/vaddr.c +39
-6+ young = young || !folio_test_idle (folio) || +mmu_notifier_test_young (mm, addr); +return young; +} + +static bool damon_va_filter_match (struct damon_filter *filter, +struct folio *folio,pte_t *pte,pmd_t *pmd, +struct mm_struct *mm,unsigned long addr) +{ +bool matched = false; + +switch (filter->type) { +case DAMON_FILTER_TYPE_PGIDLE_UNSET : +if (!folio) + matched = false; +else + matched =damon_va_young_addr (folio, pte, pmd, mm, + addr); +break ; +default : +return damon_ops_filter_match (filter, folio); + } +return matched == filter->matching; +} + +static bool damon_va_filter_pass (struct folio *folio,struct damon_probe *p, +pte_t *pte,pmd_t *pmd,struct mm_struct *mm, +unsigned long addr) {struct damon_filter *f;bool pass = true;damon_for_each_filter (f, p) { -if (damon_ops_filter_match (f, folio)) { +if (damon_va_filter_match (f, folio, pte, pmd, mm, addr)) { pass = f->allow;break ; }@@ -543,13 +579,15 @@ struct damon_va_probe_walk_private { };static void damon_va_probe_folio (struct damon_ctx *ctx, -struct damon_region *r,struct folio *folio) +struct damon_region *r,struct folio *folio, +pte_t *pte,pmd_t *pmd,struct mm_struct *mm) {struct damon_probe *probe;int i =0 ;damon_for_each_probe (probe, ctx) { -if (damon_va_filter_pass (folio, probe)) +if (damon_va_filter_pass (folio, probe, pte, pmd, mm, + r->sampling_addr)) r->probe_hits[i]++; i++; }@@ -574,7 +612,8 @@ static int damon_va_probe_pmd_entry(pmd_t *pmd, unsigned long addr, folio =vm_normal_folio_pmd (walk->vma, addr, pmde);if (!folio) goto huge_out; -damon_va_probe_folio (priv->ctx, priv->r, folio); +damon_va_probe_folio (priv->ctx, priv->r, folio,NULL , &pmde, + walk->vma->vm_mm); huge_out:spin_unlock (ptl);@@ -591,7 +630,8 @@ static int damon_va_probe_pmd_entry(pmd_t *pmd, unsigned long addr, folio =vm_normal_folio (walk->vma, addr, ptent);if (!folio) goto out; -damon_va_probe_folio (priv->ctx, priv->r, folio); +damon_va_probe_folio (priv->ctx, priv->r, folio, &ptent,NULL , + walk->vma->vm_mm); out:pte_unmap_unlock (pte, ptl);@@ -615,7 +655,8 @@ static int damon_va_probe_hugetlb_entry(pte_t *pte, unsigned long hmask, folio =pfn_folio (pte_pfn (entry));folio_get (folio); -damon_va_probe_folio (priv->ctx, priv->r, folio); +damon_va_probe_folio (priv->ctx, priv->r, folio, &entry,NULL , + walk->vma->vm_mm);folio_put (folio); out:Signature · 1 line
2.47.3
Sent using hkml (https://github.com/sjp38/hackermail)
SJ Park
maintainerRe: [PATCH REPOST 5/5] mm/damon/vaddr: support pgidle_unset probe filter type
Hi Kunwu,
Quoted 33 lines · On Fri, 11 Sep 2026 18:04:26 +0800 Kunwu Chan <[email protected]> wrote:
Quoted 16 lines · On Wed, 9 Sep 2026 07:04:07 -0700 SJ Park <[email protected]> wrote:
DAMON virtual address space operation set (vaddr) does not support
pgidle_unsetprobe filter type. Add the support.Signed-off-by SJ Park <[email protected]>--- mm/damon/vaddr.c | 55 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 7 deletions(-)mm/damon/vaddr.c +0
-0@@ -522,13 +522,49 @@ static void damon_va_prep_probes(struct damon_ctx *ctx, bool set_samples) } }mm/damon/vaddr.c static void damon_va_prep_probes(struct damon_ctx *ctx, bool set_samples) · line 533
Quoted 10 lines
mm/damon/vaddr.c +9
-1-static bool damon_va_filter_pass (struct folio *folio,struct damon_probe *p) +static bool damon_va_young_addr (struct folio *folio,pte_t *pte,pmd_t *pmd, +struct mm_struct *mm,unsigned long addr) +{ +bool young = false; + +if (pte) + young =pte_young (*pte); +else if (pmd) + young =pmd_young (*pmd);Hi SJ,
I see that all callers already checkpte_present()/pmd_present()before calling this helper, so I don't see a correctness issue here.
Quoted 6 lines
However, the other DAMON young/accessed helpers, such as
damon_pte_young(),damon_hugetlb_young(), and the PMD path indamon_folio_young_one(), keep the present check together with the young check.Would it make sense to keep the same check here for consistency?
In my humble opinion, it is already consistent as long as we didn't miss present check in callers. If you concern a case that we call damon_va_young_addr() without present check in future, how about adding a comment noting that on damon_va_young_addr() as a followup work?
Also, thank you for your reviews to this series!
Thanks,
SJ
[...]
KunWu Chan
Reviewed-byRe: [PATCH REPOST 5/5] mm/damon/vaddr: support pgidle_unset probe filter type
Quoted 43 lines · SJ Park
Hi Kunwu,
Quoted 38 lines · On Fri, 11 Sep 2026 18:04:26 +0800 Kunwu Chan <[email protected]> wrote:
Quoted 16 lines · On Wed, 9 Sep 2026 07:04:07 -0700 SJ Park <[email protected]> wrote:
DAMON virtual address space operation set (vaddr) does not support
pgidle_unsetprobe filter type. Add the support.Signed-off-by SJ Park <[email protected]>--- mm/damon/vaddr.c | 55 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 7 deletions(-)mm/damon/vaddr.c +0
-0@@ -522,13 +522,49 @@ static void damon_va_prep_probes(struct damon_ctx *ctx, bool set_samples) } }mm/damon/vaddr.c static void damon_va_prep_probes(struct damon_ctx *ctx, bool set_samples) · line 533
Quoted 10 lines
mm/damon/vaddr.c +9
-1-static bool damon_va_filter_pass (struct folio *folio,struct damon_probe *p) +static bool damon_va_young_addr (struct folio *folio,pte_t *pte,pmd_t *pmd, +struct mm_struct *mm,unsigned long addr) +{ +bool young = false; + +if (pte) + young =pte_young (*pte); +else if (pmd) + young =pmd_young (*pmd);Hi SJ,
I see that all callers already checkpte_present()/pmd_present()before calling this helper, so I don't see a correctness issue here.However, the other DAMON young/accessed helpers, such as
damon_pte_young(),damon_hugetlb_young(), and the PMD path indamon_folio_young_one(), keep the present check together with the young check.
Quoted 7 lines
Quoted 1 line
Would it make sense to keep the same check here for consistency?
In my humble opinion, it is already consistent as long as we didn't miss present check in callers. If you concern a case that we call
damon_va_young_addr()without present check in future, how about adding a comment noting that ondamon_va_young_addr()as a followup work?
Thanks, SJ. That makes sense to me.
The current callers do provide the required ‘present’ check, so I agree that documenting the assumption in a follow-up comment should be sufficient.
Thanks,
Kunwu
Quoted 7 lines
Also, thank you for your reviews to this series!
Thanks,
SJ[...]
Hi SJ,
Quoted 107 lines · SJ Park
DAMON supports data attributes monitoring. However, only the physical address space operation set (paddr) is supporting it. Add the support to the virtual address space operation set (vaddr).
Patch 1 adds
prep_probessupport to vaddr. Patch 2 moves probe filter handling code inpaddr.cthat can be reused by vaddr toops-common.c. Patch 3 adds minimumapply_probessupport to vaddr. Patch 4 extends the support for hugetlb. Patch 5 extends the support forpgidle_unsetfilter.Test
====I confirmed it can capture ~48 mb working set of masim in vaddr mode, like below.
First, start masim [1] to access ~48 mb memory at a time, in the background.
$ ./masim/masim.py run \ --config_file ./masim/configs/stairs-50mb.cfg \ --repeat 10 --quiet &Note that the config says the working set is 50mb. It is 50 million bytes, so ~48 MiB.
Start traditional access monitoring of masim's virtual address space using damo [2].
$ sudo ./damo/damo start $(pidof masim)Confirm it can capture the ~48 MiB working set as the 4-th region on the snapshot.
$ sudo ./damo/damo report access heatmap: 11111111334[...]3000000000000000000000000000000000000000489999997777777743333333555556[...]8 # min/max temperatures: -1,150,000,000, 80,009,499, column size: 6.963 MiB intervals: sample 5 ms aggr 100 ms (max access hz 200) 0 addr 85.355 TiB size 55.703 MiB access 0 hz age 9.500 s 1 addr 85.355 TiB size 18.984 MiB access 0 hz age 6.700 s 2 addr 127.183 TiB size 278.516 MiB access 0 hz age 11.500 s 3 addr 127.183 TiB size 7.570 MiB access 0 hz age 900 ms 4 addr 127.183 TiB size 48.133 MiB access 190 hz age 800 ms 5 addr 127.183 TiB size 54.977 MiB access 0 hz age 1.700 s 6 addr 127.183 TiB size 55.113 MiB access 0 hz age 6.700 s 7 addr 127.183 TiB size 37.902 MiB access 0 hz age 3.900 s 8 addr 127.990 TiB size 120.000 KiB access 0 hz age 11.400 s 9 addr 127.990 TiB size 8.000 KiB access 70 hz age 0 ns 10 addr 127.990 TiB size 4.000 KiB access 0 hz age 11.200 s memory bw estimate: 8.931 GiB per second total size: 557.027 MiB record DAMON intervals: sample 5 ms, aggr 100 msStop access monitoring and start probe-only mode access monitoring.
$ sudo ./damo/damo stop $ sudo ./damo/damo start $(pidof masim) --probe_prep set_pgidle \ --probe_filter allow pgidle_unset --probe_weight 1Confirm it can also capture the ~48 MiB working set as the 11-th region on the snapshot.
$ sudo ./damo/damo report attrs heatmap: 00000000113[...]40000000000000000000000000000000000000000000000001111114999999533333336[...]6 # min/max temperatures: -840,000,000, 330,002,000, column size: 6.961 MiB probe prep: set_pgidle, filter: allow pgidle_unset (weight: 1) intervals: sample 5 ms aggr 100 ms (max probe hits 20) # size address age probe_hits 0 8.000 KiB 127.990 TiB 8.700 s 0 1 120.000 KiB 127.990 TiB 8.600 s 0 2 55.543 MiB 127.183 TiB 8.400 s 0 3 110.008 MiB 127.183 TiB 8.300 s 0 4 55.352 MiB 127.183 TiB 8.100 s 0 5 55.605 MiB 127.183 TiB 8 s 0 6 55.691 MiB 85.355 TiB 7.900 s 0 7 54.430 MiB 127.183 TiB 7.900 s 0 8 50.391 MiB 127.183 TiB 6.900 s 0 9 18.879 MiB 85.355 TiB 6 s 0 10 52.844 MiB 127.183 TiB 3.500 s 0 11 48.039 MiB 127.183 TiB 3.300 s 20 12 4.000 KiB 127.990 TiB 8.500 s 20 memory bw estimate: 0 B per second total size: 556.910 MiB record DAMON intervals: sample 5 ms, aggr 100 ms[1] https://github.com/sjp38/masim
[2] https://github.com/damonitor/damoChanges from v1 original post
- v1: https://lore.kernel.org/[email protected]
- Rebase to latest mm-new.
Changes from RFC
- RFC: https://lore.kernel.org/[email protected]
- Drop RFC tag.
- Rebase to latest mm-new.SJ Park (5):
mm/damon/vaddr: supportprep_probesmm/damon/paddr: move probe filter handling to ops-commonmm/damon/vaddr: supportapply_probemm/damon/vaddr: extendapply_probes()for hugetlbmm/damon/vaddr: supportpgidle_unsetprobe filter type
Quoted 8 lines
mm/damon/ops-common.c | 32 ++++++ mm/damon/ops-common.h | 2 + mm/damon/paddr.c | 23 +---- mm/damon/vaddr.c | 232 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 267 insertions(+), 22 deletions(-)base-commit:
da659d141e9797b3a2e5d0e2b457bfa4e8a8cb2d
Nice to see the progress with probes.
Since you are adding prep_probes for vaddr, do we need to check for the existence of prep_probes in kdamond_fn?
How about this?
mm/damon/core.c +1 -1
@@ -3935,7 +3935,7 @@ static int kdamond_fn(void *data)if (kdamond_wait_activation (ctx))break ; - do_prep = ctx->ops.prep_probes &&damon_has_prep (ctx); + do_prep =damon_has_prep (ctx);if (!access_check_disabled && ctx->ops.prepare_access_checks) ctx->ops.prepare_access_checks (ctx);
And maybe change the name of the variable to has_prep.
Signature · 2 lines
Asier Gutierrez Huawei
SJ Park
maintainerHi Asier,
Quoted 140 lines · On Wed, 9 Sep 2026 17:25:51 +0300 Gutierrez Asier…
Hi SJ,
Quoted 107 lines · SJ Park
DAMON supports data attributes monitoring. However, only the physical address space operation set (paddr) is supporting it. Add the support to the virtual address space operation set (vaddr).
Patch 1 adds
prep_probessupport to vaddr. Patch 2 moves probe filter handling code inpaddr.cthat can be reused by vaddr toops-common.c. Patch 3 adds minimumapply_probessupport to vaddr. Patch 4 extends the support for hugetlb. Patch 5 extends the support forpgidle_unsetfilter.Test
====I confirmed it can capture ~48 mb working set of masim in vaddr mode, like below.
First, start masim [1] to access ~48 mb memory at a time, in the background.
$ ./masim/masim.py run \ --config_file ./masim/configs/stairs-50mb.cfg \ --repeat 10 --quiet &Note that the config says the working set is 50mb. It is 50 million bytes, so ~48 MiB.
Start traditional access monitoring of masim's virtual address space using damo [2].
$ sudo ./damo/damo start $(pidof masim)Confirm it can capture the ~48 MiB working set as the 4-th region on the snapshot.
$ sudo ./damo/damo report access heatmap: 11111111334[...]3000000000000000000000000000000000000000489999997777777743333333555556[...]8 # min/max temperatures: -1,150,000,000, 80,009,499, column size: 6.963 MiB intervals: sample 5 ms aggr 100 ms (max access hz 200) 0 addr 85.355 TiB size 55.703 MiB access 0 hz age 9.500 s 1 addr 85.355 TiB size 18.984 MiB access 0 hz age 6.700 s 2 addr 127.183 TiB size 278.516 MiB access 0 hz age 11.500 s 3 addr 127.183 TiB size 7.570 MiB access 0 hz age 900 ms 4 addr 127.183 TiB size 48.133 MiB access 190 hz age 800 ms 5 addr 127.183 TiB size 54.977 MiB access 0 hz age 1.700 s 6 addr 127.183 TiB size 55.113 MiB access 0 hz age 6.700 s 7 addr 127.183 TiB size 37.902 MiB access 0 hz age 3.900 s 8 addr 127.990 TiB size 120.000 KiB access 0 hz age 11.400 s 9 addr 127.990 TiB size 8.000 KiB access 70 hz age 0 ns 10 addr 127.990 TiB size 4.000 KiB access 0 hz age 11.200 s memory bw estimate: 8.931 GiB per second total size: 557.027 MiB record DAMON intervals: sample 5 ms, aggr 100 msStop access monitoring and start probe-only mode access monitoring.
$ sudo ./damo/damo stop $ sudo ./damo/damo start $(pidof masim) --probe_prep set_pgidle \ --probe_filter allow pgidle_unset --probe_weight 1Confirm it can also capture the ~48 MiB working set as the 11-th region on the snapshot.
$ sudo ./damo/damo report attrs heatmap: 00000000113[...]40000000000000000000000000000000000000000000000001111114999999533333336[...]6 # min/max temperatures: -840,000,000, 330,002,000, column size: 6.961 MiB probe prep: set_pgidle, filter: allow pgidle_unset (weight: 1) intervals: sample 5 ms aggr 100 ms (max probe hits 20) # size address age probe_hits 0 8.000 KiB 127.990 TiB 8.700 s 0 1 120.000 KiB 127.990 TiB 8.600 s 0 2 55.543 MiB 127.183 TiB 8.400 s 0 3 110.008 MiB 127.183 TiB 8.300 s 0 4 55.352 MiB 127.183 TiB 8.100 s 0 5 55.605 MiB 127.183 TiB 8 s 0 6 55.691 MiB 85.355 TiB 7.900 s 0 7 54.430 MiB 127.183 TiB 7.900 s 0 8 50.391 MiB 127.183 TiB 6.900 s 0 9 18.879 MiB 85.355 TiB 6 s 0 10 52.844 MiB 127.183 TiB 3.500 s 0 11 48.039 MiB 127.183 TiB 3.300 s 20 12 4.000 KiB 127.990 TiB 8.500 s 20 memory bw estimate: 0 B per second total size: 556.910 MiB record DAMON intervals: sample 5 ms, aggr 100 ms[1] https://github.com/sjp38/masim
[2] https://github.com/damonitor/damoChanges from v1 original post
- v1: https://lore.kernel.org/[email protected]
- Rebase to latest mm-new.
Changes from RFC
- RFC: https://lore.kernel.org/[email protected]
- Drop RFC tag.
- Rebase to latest mm-new.SJ Park (5):
mm/damon/vaddr: supportprep_probesmm/damon/paddr: move probe filter handling to ops-commonmm/damon/vaddr: supportapply_probemm/damon/vaddr: extendapply_probes()for hugetlbmm/damon/vaddr: supportpgidle_unsetprobe filter typeQuoted 8 lines
mm/damon/ops-common.c | 32 ++++++ mm/damon/ops-common.h | 2 + mm/damon/paddr.c | 23 +---- mm/damon/vaddr.c | 232 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 267 insertions(+), 22 deletions(-)base-commit:
da659d141e9797b3a2e5d0e2b457bfa4e8a8cb2dNice to see the progress with probes.
Since you are adding
prep_probesfor vaddr, do we need to check for the existence ofprep_probesinkdamond_fn?How about this?
mm/damon/core.c +1
-1@@ -3935,7 +3935,7 @@ static int kdamond_fn(void *data)if (kdamond_wait_activation (ctx))break ; - do_prep = ctx->ops.prep_probes &&damon_has_prep (ctx); + do_prep =damon_has_prep (ctx);if (!access_check_disabled && ctx->ops.prepare_access_checks) ctx->ops.prepare_access_checks (ctx);
Quoted 1 line
And maybe change the name of the variable to
has_prep.
I'm sorry but I don't understand a benefit of the change. Rather, I show it could cause a problem. Later code does below:
if (do_prep)
ctx->ops.prep_probes(ctx, access_check_disabled);If do_prep is true but ctx->ops.prep_probes is NULL, this will cause a problem.
Am I missing something?
Thanks,
SJ
[...]
Quoted 149 lines · SJ Park
Hi Asier,
Quoted 140 lines · On Wed, 9 Sep 2026 17:25:51 +0300 Gutierrez Asier…
Hi SJ,
Quoted 107 lines · SJ Park
DAMON supports data attributes monitoring. However, only the physical address space operation set (paddr) is supporting it. Add the support to the virtual address space operation set (vaddr).
Patch 1 adds
prep_probessupport to vaddr. Patch 2 moves probe filter handling code inpaddr.cthat can be reused by vaddr toops-common.c. Patch 3 adds minimumapply_probessupport to vaddr. Patch 4 extends the support for hugetlb. Patch 5 extends the support forpgidle_unsetfilter.Test
====I confirmed it can capture ~48 mb working set of masim in vaddr mode, like below.
First, start masim [1] to access ~48 mb memory at a time, in the background.
$ ./masim/masim.py run \ --config_file ./masim/configs/stairs-50mb.cfg \ --repeat 10 --quiet &Note that the config says the working set is 50mb. It is 50 million bytes, so ~48 MiB.
Start traditional access monitoring of masim's virtual address space using damo [2].
$ sudo ./damo/damo start $(pidof masim)Confirm it can capture the ~48 MiB working set as the 4-th region on the snapshot.
$ sudo ./damo/damo report access heatmap: 11111111334[...]3000000000000000000000000000000000000000489999997777777743333333555556[...]8 # min/max temperatures: -1,150,000,000, 80,009,499, column size: 6.963 MiB intervals: sample 5 ms aggr 100 ms (max access hz 200) 0 addr 85.355 TiB size 55.703 MiB access 0 hz age 9.500 s 1 addr 85.355 TiB size 18.984 MiB access 0 hz age 6.700 s 2 addr 127.183 TiB size 278.516 MiB access 0 hz age 11.500 s 3 addr 127.183 TiB size 7.570 MiB access 0 hz age 900 ms 4 addr 127.183 TiB size 48.133 MiB access 190 hz age 800 ms 5 addr 127.183 TiB size 54.977 MiB access 0 hz age 1.700 s 6 addr 127.183 TiB size 55.113 MiB access 0 hz age 6.700 s 7 addr 127.183 TiB size 37.902 MiB access 0 hz age 3.900 s 8 addr 127.990 TiB size 120.000 KiB access 0 hz age 11.400 s 9 addr 127.990 TiB size 8.000 KiB access 70 hz age 0 ns 10 addr 127.990 TiB size 4.000 KiB access 0 hz age 11.200 s memory bw estimate: 8.931 GiB per second total size: 557.027 MiB record DAMON intervals: sample 5 ms, aggr 100 msStop access monitoring and start probe-only mode access monitoring.
$ sudo ./damo/damo stop $ sudo ./damo/damo start $(pidof masim) --probe_prep set_pgidle \ --probe_filter allow pgidle_unset --probe_weight 1Confirm it can also capture the ~48 MiB working set as the 11-th region on the snapshot.
$ sudo ./damo/damo report attrs heatmap: 00000000113[...]40000000000000000000000000000000000000000000000001111114999999533333336[...]6 # min/max temperatures: -840,000,000, 330,002,000, column size: 6.961 MiB probe prep: set_pgidle, filter: allow pgidle_unset (weight: 1) intervals: sample 5 ms aggr 100 ms (max probe hits 20) # size address age probe_hits 0 8.000 KiB 127.990 TiB 8.700 s 0 1 120.000 KiB 127.990 TiB 8.600 s 0 2 55.543 MiB 127.183 TiB 8.400 s 0 3 110.008 MiB 127.183 TiB 8.300 s 0 4 55.352 MiB 127.183 TiB 8.100 s 0 5 55.605 MiB 127.183 TiB 8 s 0 6 55.691 MiB 85.355 TiB 7.900 s 0 7 54.430 MiB 127.183 TiB 7.900 s 0 8 50.391 MiB 127.183 TiB 6.900 s 0 9 18.879 MiB 85.355 TiB 6 s 0 10 52.844 MiB 127.183 TiB 3.500 s 0 11 48.039 MiB 127.183 TiB 3.300 s 20 12 4.000 KiB 127.990 TiB 8.500 s 20 memory bw estimate: 0 B per second total size: 556.910 MiB record DAMON intervals: sample 5 ms, aggr 100 ms[1] https://github.com/sjp38/masim
[2] https://github.com/damonitor/damoChanges from v1 original post
- v1: https://lore.kernel.org/[email protected]
- Rebase to latest mm-new.
Changes from RFC
- RFC: https://lore.kernel.org/[email protected]
- Drop RFC tag.
- Rebase to latest mm-new.SJ Park (5):
mm/damon/vaddr: supportprep_probesmm/damon/paddr: move probe filter handling to ops-commonmm/damon/vaddr: supportapply_probemm/damon/vaddr: extendapply_probes()for hugetlbmm/damon/vaddr: supportpgidle_unsetprobe filter typeQuoted 8 lines
mm/damon/ops-common.c | 32 ++++++ mm/damon/ops-common.h | 2 + mm/damon/paddr.c | 23 +---- mm/damon/vaddr.c | 232 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 267 insertions(+), 22 deletions(-)base-commit:
da659d141e9797b3a2e5d0e2b457bfa4e8a8cb2dNice to see the progress with probes.
Since you are adding
prep_probesfor vaddr, do we need to check for the existence ofprep_probesinkdamond_fn?How about this?
mm/damon/core.c +1
-1@@ -3935,7 +3935,7 @@ static int kdamond_fn(void *data)if (kdamond_wait_activation (ctx))break ; - do_prep = ctx->ops.prep_probes &&damon_has_prep (ctx); + do_prep =damon_has_prep (ctx);if (!access_check_disabled && ctx->ops.prepare_access_checks) ctx->ops.prepare_access_checks (ctx);Quoted 1 line
And maybe change the name of the variable to
has_prep.I'm sorry but I don't understand a benefit of the change. Rather, I show it could cause a problem. Later code does below:
Quoted 6 lines
if (do_prep) ctx->ops.prep_probes(ctx, access_check_disabled);If
do_prepis true butctx->ops.prep_probesis NULL, this will cause a problem.Am I missing something?
I was under the impression that with the change, all possible operations would have a prep_probes handler. I just noticed that we also have fvaddr, where ctx->ops.prep_probes is NULL.
Ignore my comment :-)>
Quoted 4 lines
Thanks,
SJ[...]
Signature · 2 lines
Asier Gutierrez Huawei
SJ Park
maintainerOn Wed, 9 Sep 2026 17:39:23 +0300 Gutierrez Asier <[email protected]> wrote:
[...]
Quoted 5 lines
I was under the impression that with the change, all possible operations would have a
prep_probeshandler. I just noticed that we also have fvaddr, wherectx->ops.prep_probesis NULL.Ignore my comment :-)>
No worry, thank you for reviewing this :)
Thanks,
SJ
[...]
SJ Park
maintainerQuoted 3 lines · On Wed, 9 Sep 2026 07:04:02 -0700 SJ Park <[email protected]> wrote:
DAMON supports data attributes monitoring. However, only the physical address space operation set (paddr) is supporting it. Add the support to the virtual address space operation set (vaddr).
Sashiko found no blocker for this series. Sashiko send its findings to damon@ mailing list [1], and I reply those if anything needs to be clarified. Please refer to those for details.
[1] https://lore.kernel.org/damon/
Thanks,
SJ
[...]