* [RFC PATCH v1.1 1/5] mm/damon/api: introduce DAMON_FILTER_TYPE_PGIDLE_SET
2026-09-10 4:09 [RFC PATCH v1.1 0/5] mm/damon: introduce pgidle_set probe filter type SJ Park
@ 2026-09-10 4:09 ` SJ Park
2026-09-10 4:09 ` [RFC PATCH v1.1 2/5] mm/damon/paddr: support DAMON_FILTER_TYPE_PGIDLE_SET SJ Park
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: SJ Park @ 2026-09-10 4:09 UTC (permalink / raw)
Cc: SJ Park, damon, linux-kernel, linux-mm
DAMON_FILTER_TYPE_PGIDLE_UNSET matches only memory that was able to
confirm if it is marked as idle. If the memory cannot be marked as
idle, it simply doesn't match. Hence, finding memory that was marked as
idle with only DAMON_FILTER_TYPE_PGIDLE_UNSET is impossible. Introduce
a new filter for the purpose, DAMON_FILTER_TYPE_PGIDLE_SET.
Signed-off-by: SJ Park <sj@kernel.org>
---
include/linux/damon.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/linux/damon.h b/include/linux/damon.h
index 9fa99f92a2e94..ec6bfc292a7cf 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -782,11 +782,13 @@ struct damon_prep {
* @DAMON_FILTER_TYPE_ANON: Anonymous pages.
* @DAMON_FILTER_TYPE_MEMCG: Specific memcg's pages.
* @DAMON_FILTER_TYPE_PGIDLE_UNSET: Pgidle is unset.
+ * @DAMON_FILTER_TYPE_PGIDLE_SET: Pgidle is set.
*/
enum damon_filter_type {
DAMON_FILTER_TYPE_ANON,
DAMON_FILTER_TYPE_MEMCG,
DAMON_FILTER_TYPE_PGIDLE_UNSET,
+ DAMON_FILTER_TYPE_PGIDLE_SET,
};
/**
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* [RFC PATCH v1.1 2/5] mm/damon/paddr: support DAMON_FILTER_TYPE_PGIDLE_SET
2026-09-10 4:09 [RFC PATCH v1.1 0/5] mm/damon: introduce pgidle_set probe filter type SJ Park
2026-09-10 4:09 ` [RFC PATCH v1.1 1/5] mm/damon/api: introduce DAMON_FILTER_TYPE_PGIDLE_SET SJ Park
@ 2026-09-10 4:09 ` SJ Park
2026-09-10 4:09 ` [RFC PATCH v1.1 3/5] mm/damon/vaddr: " SJ Park
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: SJ Park @ 2026-09-10 4:09 UTC (permalink / raw)
Cc: SJ Park, Andrew Morton, damon, linux-kernel, linux-mm
Implement DAMON_FILTER_TYPE_PGIDLE_SET support on the physical address
space DAMON operation set (paddr).
Signed-off-by: SJ Park <sj@kernel.org>
---
mm/damon/paddr.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
index b8f4d28165dd7..5abfabaa339e0 100644
--- a/mm/damon/paddr.c
+++ b/mm/damon/paddr.c
@@ -151,6 +151,12 @@ static bool damon_pa_filter_match(struct damon_filter *filter,
else
matched = damon_folio_young(folio);
break;
+ case DAMON_FILTER_TYPE_PGIDLE_SET:
+ if (!folio)
+ matched = false;
+ else
+ matched = damon_folio_young(folio) == false;
+ break;
default:
return damon_ops_filter_match(filter, folio);
}
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* [RFC PATCH v1.1 3/5] mm/damon/vaddr: support DAMON_FILTER_TYPE_PGIDLE_SET
2026-09-10 4:09 [RFC PATCH v1.1 0/5] mm/damon: introduce pgidle_set probe filter type SJ Park
2026-09-10 4:09 ` [RFC PATCH v1.1 1/5] mm/damon/api: introduce DAMON_FILTER_TYPE_PGIDLE_SET SJ Park
2026-09-10 4:09 ` [RFC PATCH v1.1 2/5] mm/damon/paddr: support DAMON_FILTER_TYPE_PGIDLE_SET SJ Park
@ 2026-09-10 4:09 ` SJ Park
2026-09-10 4:09 ` [RFC PATCH v1.1 4/5] mm/damon/sysfs: " SJ Park
2026-09-10 4:09 ` [RFC PATCH v1.1 5/5] Docs/mm/damon/design: update for pgidle_set probe filter SJ Park
4 siblings, 0 replies; 6+ messages in thread
From: SJ Park @ 2026-09-10 4:09 UTC (permalink / raw)
Cc: SJ Park, Andrew Morton, damon, linux-kernel, linux-mm
Implement DAMON_FILTER_TYPE_PGIDLE_SET support on the virtual address
space DAMON operation set (vaddr).
Signed-off-by: SJ Park <sj@kernel.org>
---
mm/damon/vaddr.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
index 4aecf34e39be2..d5dde97b3cd0d 100644
--- a/mm/damon/vaddr.c
+++ b/mm/damon/vaddr.c
@@ -550,6 +550,13 @@ static bool damon_va_filter_match(struct damon_filter *filter,
matched = damon_va_young_addr(folio, pte, pmd, mm,
addr);
break;
+ case DAMON_FILTER_TYPE_PGIDLE_SET:
+ if (!folio)
+ matched = false;
+ else
+ matched = !damon_va_young_addr(folio, pte, pmd, mm,
+ addr);
+ break;
default:
return damon_ops_filter_match(filter, folio);
}
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [RFC PATCH v1.1 4/5] mm/damon/sysfs: support DAMON_FILTER_TYPE_PGIDLE_SET
2026-09-10 4:09 [RFC PATCH v1.1 0/5] mm/damon: introduce pgidle_set probe filter type SJ Park
` (2 preceding siblings ...)
2026-09-10 4:09 ` [RFC PATCH v1.1 3/5] mm/damon/vaddr: " SJ Park
@ 2026-09-10 4:09 ` SJ Park
2026-09-10 4:09 ` [RFC PATCH v1.1 5/5] Docs/mm/damon/design: update for pgidle_set probe filter SJ Park
4 siblings, 0 replies; 6+ messages in thread
From: SJ Park @ 2026-09-10 4:09 UTC (permalink / raw)
Cc: SJ Park, Andrew Morton, damon, linux-kernel, linux-mm
Extend DAMON sysfs interface to let users setup
DAMON_FILTER_TYPE_PGIDLE_SET probe filter.
Signed-off-by: SJ Park <sj@kernel.org>
---
mm/damon/sysfs.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index b576e97cbfdb8..51fa506c879b0 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -1001,6 +1001,10 @@ damon_sysfs_filter_type_names[] = {
.type = DAMON_FILTER_TYPE_PGIDLE_UNSET,
.name = "pgidle_unset",
},
+ {
+ .type = DAMON_FILTER_TYPE_PGIDLE_SET,
+ .name = "pgidle_set",
+ },
};
static ssize_t type_show(struct kobject *kobj,
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* [RFC PATCH v1.1 5/5] Docs/mm/damon/design: update for pgidle_set probe filter
2026-09-10 4:09 [RFC PATCH v1.1 0/5] mm/damon: introduce pgidle_set probe filter type SJ Park
` (3 preceding siblings ...)
2026-09-10 4:09 ` [RFC PATCH v1.1 4/5] mm/damon/sysfs: " SJ Park
@ 2026-09-10 4:09 ` SJ Park
4 siblings, 0 replies; 6+ messages in thread
From: SJ Park @ 2026-09-10 4:09 UTC (permalink / raw)
Cc: SJ Park, Liam R. Howlett, Andrew Morton, David Hildenbrand,
Jonathan Corbet, Lorenzo Stoakes, Michal Hocko, Mike Rapoport,
Randy Dunlap, Shuah Khan, Suren Baghdasaryan, Vlastimil Babka,
damon, linux-doc, linux-kernel, linux-mm
Update DAMON design document for the newly added pgidle_set probe filter
type.
Signed-off-by: SJ Park <sj@kernel.org>
---
Documentation/mm/damon/design.rst | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst
index 8e980dde362de..cb116a82ff20b 100644
--- a/Documentation/mm/damon/design.rst
+++ b/Documentation/mm/damon/design.rst
@@ -299,6 +299,7 @@ filter types. Currently below filter types are supported.
- ``memcg``: Same to that for DAMOS filters.
- ``pgidle_unset``: Matches if the page for the memory is marked as not
access-idle.
+- ``pgidle_set``: Matches if the page for the memory is marked as access-idle.
If such probes are registered, DAMON executes the probes for each region's
sampling memory when it does the access :ref:`sampling
@@ -314,7 +315,7 @@ actions are registered, DAMON applies the actions to each region's sampling
memory before starting the next sampling interval. Currently only one action,
``set_pgidle`` is supported. The action marks the page for the probing target
memory as access-idle. This can be useful to be used together with
-``pgidle_unset`` probe filter.
+``pgidle_unset`` or ``pgidle_set`` probe filter.
This is a sampling based mechanism. Hence, it is lightweight but the output
may include some measurement errors. The output should be used with good
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread