* [PATCH 0/4] mm/damon: add lru-active probe filter type
@ 2026-11-13 5:17 SJ Park
2026-11-13 5:17 ` [PATCH 1/4] mm/damon/api: define DAMON_FILTER_TYPE_ACTIVE SJ Park
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: SJ Park @ 2026-11-13 5:17 UTC (permalink / raw)
To: Andrew Morton
Cc: SJ Park, Jonathan Corbet, Randy Dunlap, Shuah Khan, damon,
linux-doc, linux-kernel, linux-mm
The LRU-activeness of folios is useful information for understanding and
optimizing the system. DAMOS ops filter therefore supports filtering
memory based on the information. Using it, the information can be
extracted in the folio granularity. It is precise but expensive. DAMON
probe filter is the complementary way for getting the information in
region granularity with much cheaper cost. DAMON filter does not
support LRU-activeness based filtering, though. Add the support.
Define new DAMON filter type, DAMON_FILTER_TYPE_ACTIVE, on core API
(patch 1). Add support for it on both vaddr and paddr operation set
(patch 2). Extend DAMON filter sysfs ABI to let users configure DAMON
filters of the type using a new keyword, "active" (patch 3). Finally,
update the DAMON design document to explain the new type (patch 4).
Test
====
Confirmed the functionality like below.
First, start masim [1] to generate a ~476 MiB hot memory region.
$ ./masim.py run --config_file ./configs/stairs-500mb.cfg --repeat 10
Second, start DAMON to monitor data access and active memory ratio of
each region using DAMON user-space tool (damo) [2].
$ sudo ./damo start --target_pid $(pidof masim) \
--probe --probe_prep set_pgidle \
--probe_filter allow pgidle_unset \
--probe --probe_filter allow active \
--probe_weight 1 0
Show the monitoring results.
$ sudo ./damo report attrs
heatmap: 00008[...]82222222222222222222222222222222222222222222222257777789999998888888874444445[...]8
# min/max temperatures: -1,580,000,000, 100,002,000, column size: 62.841 MiB
probes
- prep: set_pgidle, filter: allow pgidle_unset (weight: 1)
- allow active (weight: 0)
intervals: sample 5 ms aggr 100 ms (max probe hits 20)
# size address age probe_hits
0 253.047 MiB 85.984 TiB 15.800 s 0 0
1 4.000 KiB 127.984 TiB 15.400 s 0 20
2 120.000 KiB 127.984 TiB 15.300 s 0 0
3 1.450 GiB 127.407 TiB 11.300 s 0 0
4 498.738 MiB 127.409 TiB 11.200 s 0 0
5 500.273 MiB 127.409 TiB 11.100 s 0 0
6 502.055 MiB 127.409 TiB 10.900 s 0 0
7 461.926 MiB 127.411 TiB 6.500 s 0 0
8 351.754 MiB 127.410 TiB 1.600 s 0 0
9 497.930 MiB 127.411 TiB 0 ns 1 0
10 8.000 KiB 127.984 TiB 0 ns 6 0
11 476.340 MiB 127.410 TiB 1 s 20 0
memory bw estimate: 0 B per second
total size: 4.909 GiB
record DAMON intervals: sample 5 ms, aggr 100 ms
The second (idx 1) 4 KiB memory region is not accessed for 15 seconds
and the page for the region is on an active LRU list. The last 476.340
MiB memory region is accessed for each sample for the last one second as
expected. And nearly all pages of the region are not on an active LRU
list.
[1] https://github.com/sjp38/masim
[2] https://github.com/damonitor/damo
Changes from RFC
- RFC: https://lore.kernel.org/20261108191615.113362-1-sj@kernel.org
- Add test results on the cover letter.
- Rebase to the latest mm-new.
- Drop RFC tag.
The test section and the changelog can be removed from the final commit
message.
SJ Park (4):
mm/damon/api: define DAMON_FILTER_TYPE_ACTIVE
mm/damon/ops-common: implement DAMON_FILTER_TYPE_ACTIVE operation
mm/damon/sysfs: support LRU-activeness based DAMON filter setup
Docs/mm/damon/design: update for DAMON_FILTER_TYPE_ACTIVE
Documentation/mm/damon/design.rst | 1 +
include/linux/damon.h | 2 ++
mm/damon/ops-common.c | 7 +++++++
mm/damon/sysfs.c | 4 ++++
4 files changed, 14 insertions(+)
base-commit: e055da336413b651d1e23d438bb5430f9350d3f8
--
2.47.3
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH 1/4] mm/damon/api: define DAMON_FILTER_TYPE_ACTIVE
2026-11-13 5:17 [PATCH 0/4] mm/damon: add lru-active probe filter type SJ Park
@ 2026-11-13 5:17 ` SJ Park
2026-11-13 5:20 ` sashiko-bot
2026-11-13 5:17 ` [PATCH 2/4] mm/damon/ops-common: implement DAMON_FILTER_TYPE_ACTIVE operation SJ Park
` (2 subsequent siblings)
3 siblings, 1 reply; 11+ messages in thread
From: SJ Park @ 2026-11-13 5:17 UTC (permalink / raw)
To: Andrew Morton; +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 c32ef79c3acea..06bd92981af21 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 related [flat|nested] 11+ messages in thread* [PATCH 2/4] mm/damon/ops-common: implement DAMON_FILTER_TYPE_ACTIVE operation
2026-11-13 5:17 [PATCH 0/4] mm/damon: add lru-active probe filter type SJ Park
2026-11-13 5:17 ` [PATCH 1/4] mm/damon/api: define DAMON_FILTER_TYPE_ACTIVE SJ Park
@ 2026-11-13 5:17 ` SJ Park
2026-11-13 5:22 ` sashiko-bot
2026-11-13 5:17 ` [PATCH 3/4] mm/damon/sysfs: support LRU-activeness based DAMON filter setup SJ Park
2026-11-13 5:17 ` [PATCH 4/4] Docs/mm/damon/design: update for DAMON_FILTER_TYPE_ACTIVE SJ Park
3 siblings, 1 reply; 11+ messages in thread
From: SJ Park @ 2026-11-13 5:17 UTC (permalink / raw)
To: Andrew Morton; +Cc: SJ Park, 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 related [flat|nested] 11+ messages in thread* [PATCH 3/4] mm/damon/sysfs: support LRU-activeness based DAMON filter setup
2026-11-13 5:17 [PATCH 0/4] mm/damon: add lru-active probe filter type SJ Park
2026-11-13 5:17 ` [PATCH 1/4] mm/damon/api: define DAMON_FILTER_TYPE_ACTIVE SJ Park
2026-11-13 5:17 ` [PATCH 2/4] mm/damon/ops-common: implement DAMON_FILTER_TYPE_ACTIVE operation SJ Park
@ 2026-11-13 5:17 ` SJ Park
2026-11-13 5:22 ` sashiko-bot
2026-11-13 5:17 ` [PATCH 4/4] Docs/mm/damon/design: update for DAMON_FILTER_TYPE_ACTIVE SJ Park
3 siblings, 1 reply; 11+ messages in thread
From: SJ Park @ 2026-11-13 5:17 UTC (permalink / raw)
To: Andrew Morton; +Cc: SJ Park, 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 related [flat|nested] 11+ messages in thread* [PATCH 4/4] Docs/mm/damon/design: update for DAMON_FILTER_TYPE_ACTIVE
2026-11-13 5:17 [PATCH 0/4] mm/damon: add lru-active probe filter type SJ Park
` (2 preceding siblings ...)
2026-11-13 5:17 ` [PATCH 3/4] mm/damon/sysfs: support LRU-activeness based DAMON filter setup SJ Park
@ 2026-11-13 5:17 ` SJ Park
2026-11-13 5:19 ` sashiko-bot
2026-11-13 9:54 ` Enze Li
3 siblings, 2 replies; 11+ messages in thread
From: SJ Park @ 2026-11-13 5:17 UTC (permalink / raw)
To: Andrew Morton
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 related [flat|nested] 11+ messages in thread* Re: [PATCH 4/4] Docs/mm/damon/design: update for DAMON_FILTER_TYPE_ACTIVE
2026-11-13 5:17 ` [PATCH 4/4] Docs/mm/damon/design: update for DAMON_FILTER_TYPE_ACTIVE SJ Park
@ 2026-11-13 5:19 ` sashiko-bot
2026-11-13 9:54 ` Enze Li
1 sibling, 0 replies; 11+ messages in thread
From: sashiko-bot @ 2026-11-13 5:19 UTC (permalink / raw)
To: SJ Park; +Cc: damon
> Update DAMON design document for the newly added LRU-activeness DAMON
> filter type.
>
> Signed-off-by: SJ Park <sj@kernel.org>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261113051711.89274-1-sj@kernel.org?part=4
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 4/4] Docs/mm/damon/design: update for DAMON_FILTER_TYPE_ACTIVE
2026-11-13 5:17 ` [PATCH 4/4] Docs/mm/damon/design: update for DAMON_FILTER_TYPE_ACTIVE SJ Park
2026-11-13 5:19 ` sashiko-bot
@ 2026-11-13 9:54 ` Enze Li
2026-11-13 14:43 ` SJ Park
1 sibling, 1 reply; 11+ messages in thread
From: Enze Li @ 2026-11-13 9:54 UTC (permalink / raw)
To: SJ Park, Andrew Morton
Cc: Jonathan Corbet, Randy Dunlap, Shuah Khan, damon, linux-doc,
linux-kernel, linux-mm
Hi SJ,
On 11/13/26 1:17 PM, SJ Park wrote:
> 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.
This reads a bit awkward to me. How about:
"Same as that for DAMOS filters."
The ``anon`` and ``memcg`` entries above use the same wording, so
it would be nice to fix those at the same time.
WDYT?
Thanks,
Enze
>
> If such probes are registered, DAMON executes the probes for each region's
> sampling memory when it does the access :ref:`sampling
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 4/4] Docs/mm/damon/design: update for DAMON_FILTER_TYPE_ACTIVE
2026-11-13 9:54 ` Enze Li
@ 2026-11-13 14:43 ` SJ Park
0 siblings, 0 replies; 11+ messages in thread
From: SJ Park @ 2026-11-13 14:43 UTC (permalink / raw)
To: Enze Li
Cc: SJ Park, Andrew Morton, Jonathan Corbet, Randy Dunlap, Shuah Khan,
damon, linux-doc, linux-kernel, linux-mm
On Fri, 13 Nov 2026 17:54:37 +0800 Enze Li <lienze@kylinos.cn> wrote:
> Hi SJ,
>
> On 11/13/26 1:17 PM, SJ Park wrote:
> > 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.
>
> This reads a bit awkward to me. How about:
>
> "Same as that for DAMOS filters."
>
> The ``anon`` and ``memcg`` entries above use the same wording, so
> it would be nice to fix those at the same time.
>
> WDYT?
Makes sense to me, thank you for sharing the finding, Enze! I also find more
"same to" usages in the doc. Would you like to send a patch for fixing those
at once?
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-11-13 14:43 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-13 5:17 [PATCH 0/4] mm/damon: add lru-active probe filter type SJ Park
2026-11-13 5:17 ` [PATCH 1/4] mm/damon/api: define DAMON_FILTER_TYPE_ACTIVE SJ Park
2026-11-13 5:20 ` sashiko-bot
2026-11-13 5:17 ` [PATCH 2/4] mm/damon/ops-common: implement DAMON_FILTER_TYPE_ACTIVE operation SJ Park
2026-11-13 5:22 ` sashiko-bot
2026-11-13 5:17 ` [PATCH 3/4] mm/damon/sysfs: support LRU-activeness based DAMON filter setup SJ Park
2026-11-13 5:22 ` sashiko-bot
2026-11-13 5:17 ` [PATCH 4/4] Docs/mm/damon/design: update for DAMON_FILTER_TYPE_ACTIVE SJ Park
2026-11-13 5:19 ` sashiko-bot
2026-11-13 9:54 ` Enze Li
2026-11-13 14:43 ` SJ Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox