* [RFC PATCH 1/4] mm/damon/api: define DAMON_FILTER_TYPE_ACTIVE
2026-11-08 19:16 [RFC PATCH 0/4] mm/damon: add lru-active probe filter type SJ Park
@ 2026-11-08 19:16 ` SJ Park
2026-11-08 19:16 ` [RFC PATCH 2/4] mm/damon/ops-common: implement DAMON_FILTER_TYPE_ACTIVE operation SJ Park
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: SJ Park @ 2026-11-08 19:16 UTC (permalink / raw)
Cc: SJ Park, damon, linux-kernel, linux-mm
Knowing which memory is on Active LRU lists is useful for understanding
and optimally operating systems. Extend the DAMON core layer to be
ready for support of that. For that, define a new damon_filter_type,
DAMON_FILTER_TYPE_ACTIVE. It has no additional arguments and therefore
no additional change in the core layer is needed. Testing if a given
memory is on an LRU list for the type of filter should be implemented in
the operation set layer.
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 1302ffb6f0bcb..858b4c6900fde 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -780,6 +780,7 @@ struct damon_prep {
* @DAMON_FILTER_TYPE_PGIDLE_UNSET: Pgidle is unset.
* @DAMON_FILTER_TYPE_PGIDLE_SET: Pgidle is set.
* @DAMON_FILTER_TYPE_HUGEPAGE_SIZE: Page is part of a hugepage.
+ * @DAMON_FILTER_TYPE_ACTIVE: LRU-active pages.
*/
enum damon_filter_type {
DAMON_FILTER_TYPE_ANON,
@@ -787,6 +788,7 @@ enum damon_filter_type {
DAMON_FILTER_TYPE_PGIDLE_UNSET,
DAMON_FILTER_TYPE_PGIDLE_SET,
DAMON_FILTER_TYPE_HUGEPAGE_SIZE,
+ DAMON_FILTER_TYPE_ACTIVE,
};
/**
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread* [RFC PATCH 2/4] mm/damon/ops-common: implement DAMON_FILTER_TYPE_ACTIVE operation
2026-11-08 19:16 [RFC PATCH 0/4] mm/damon: add lru-active probe filter type SJ Park
2026-11-08 19:16 ` [RFC PATCH 1/4] mm/damon/api: define DAMON_FILTER_TYPE_ACTIVE SJ Park
@ 2026-11-08 19:16 ` SJ Park
2026-11-08 19:16 ` [RFC PATCH 3/4] mm/damon/sysfs: support LRU-activeness based DAMON filter setup SJ Park
2026-11-08 19:16 ` [RFC PATCH 4/4] Docs/mm/damon/design: update for DAMON_FILTER_TYPE_ACTIVE SJ Park
3 siblings, 0 replies; 5+ messages in thread
From: SJ Park @ 2026-11-08 19:16 UTC (permalink / raw)
Cc: SJ Park, Andrew Morton, damon, linux-kernel, linux-mm
Implement DAMON_FILTER_TYPE_ACTIVE operation. Use folio_test_active()
to show if the folio of the given memory is on an active LRU list. The
implementation is made on ops-common, so both vaddr and paddr gain the
support of the filter type.
Signed-off-by: SJ Park <sj@kernel.org>
---
mm/damon/ops-common.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/mm/damon/ops-common.c b/mm/damon/ops-common.c
index b9571f53e538c..2216a0023154f 100644
--- a/mm/damon/ops-common.c
+++ b/mm/damon/ops-common.c
@@ -574,6 +574,13 @@ bool damon_ops_filter_match(struct damon_filter *filter, struct folio *folio)
matched = filter->range_min <= folio_sz &&
folio_sz <= filter->range_max;
break;
+ case DAMON_FILTER_TYPE_ACTIVE:
+ if (!folio) {
+ matched = false;
+ break;
+ }
+ matched = folio_test_active(folio);
+ break;
default:
break;
}
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread* [RFC PATCH 3/4] mm/damon/sysfs: support LRU-activeness based DAMON filter setup
2026-11-08 19:16 [RFC PATCH 0/4] mm/damon: add lru-active probe filter type SJ Park
2026-11-08 19:16 ` [RFC PATCH 1/4] mm/damon/api: define DAMON_FILTER_TYPE_ACTIVE SJ Park
2026-11-08 19:16 ` [RFC PATCH 2/4] mm/damon/ops-common: implement DAMON_FILTER_TYPE_ACTIVE operation SJ Park
@ 2026-11-08 19:16 ` SJ Park
2026-11-08 19:16 ` [RFC PATCH 4/4] Docs/mm/damon/design: update for DAMON_FILTER_TYPE_ACTIVE SJ Park
3 siblings, 0 replies; 5+ messages in thread
From: SJ Park @ 2026-11-08 19:16 UTC (permalink / raw)
Cc: SJ Park, Andrew Morton, damon, linux-kernel, linux-mm
Support DAMON sysfs interface based setup of DAMON_FILTER_TYPE_ACTIVE
type DAMON filters. For that, wire the type with a new user keyword,
"active". Users can set up the new type of filter using the existing
DAMON filter setup interface with the new keyword.
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 70a4b64fb8ea9..779c98205a94b 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -1011,6 +1011,10 @@ damon_sysfs_filter_type_names[] = {
.type = DAMON_FILTER_TYPE_HUGEPAGE_SIZE,
.name = "hugepage_size",
},
+ {
+ .type = DAMON_FILTER_TYPE_ACTIVE,
+ .name = "active",
+ },
};
static ssize_t type_show(struct kobject *kobj,
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread* [RFC PATCH 4/4] Docs/mm/damon/design: update for DAMON_FILTER_TYPE_ACTIVE
2026-11-08 19:16 [RFC PATCH 0/4] mm/damon: add lru-active probe filter type SJ Park
` (2 preceding siblings ...)
2026-11-08 19:16 ` [RFC PATCH 3/4] mm/damon/sysfs: support LRU-activeness based DAMON filter setup SJ Park
@ 2026-11-08 19:16 ` SJ Park
3 siblings, 0 replies; 5+ messages in thread
From: SJ Park @ 2026-11-08 19:16 UTC (permalink / raw)
Cc: SJ Park, Jonathan Corbet, Randy Dunlap, Shuah Khan, damon,
linux-doc, linux-kernel, linux-mm
Update DAMON design document for the newly added LRU-activeness DAMON
filter type.
Signed-off-by: SJ Park <sj@kernel.org>
---
Documentation/mm/damon/design.rst | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst
index 8440c4954090e..b676be6971589 100644
--- a/Documentation/mm/damon/design.rst
+++ b/Documentation/mm/damon/design.rst
@@ -302,6 +302,7 @@ filter types. Currently below filter types are supported.
- ``pgidle_set``: Matches if the page for the memory is marked as access-idle.
- ``hugepage_size``: Matches if the page for the memory is a part of a hugepage
of a given size range.
+- ``active``: Same to that for DAMOS filters.
If such probes are registered, DAMON executes the probes for each region's
sampling memory when it does the access :ref:`sampling
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread