* Wrong example command for auto-tuned DAMON-based proactive reclamation, and solution/workarounds
@ 2026-11-22 20:22 SJ Park
2026-12-01 2:13 ` SJ Park
0 siblings, 1 reply; 4+ messages in thread
From: SJ Park @ 2026-11-22 20:22 UTC (permalink / raw)
To: damon; +Cc: SJ Park, linux-mm, linux-kernel
Hello community,
I suggested wrong way to utilize DAMON for auto-tuned proactive reclamation.
Let me explain more details and correct way to do that.
Wrong Suggestion
================
In OSSummit Europe'26 and a few offline discussions, I suggested [1,2,3] people
to try DAMON-based auto-tuned based proactive reclamation using DAMON
user-space tool (damo) [4] like below:
$ sudo ./damo start --monitoring_intervals_autotune \
--damos_action pageout --damos_access_rate 0% 0% \
--damos_age 2m max \
--damos_quota_space 128M --damos_quota_interval 1s \
--damos_quota_goal some_mem_psi_us 5000
I found [5] it will reclaim much less than expected amount of memory. That's
due to the mixed use of '--damos_age' and '--monitoring_intervals_autotune'.
The intention is to reclaim regions that not accessed for two or more minutes,
while auto-tuning DAMON internal for optimum access monitoring. But, in this
setup, the coldness threshold (2 minutes) can increase up to 4,000 minutes.
Memory that unaccessed for 4,000 or more would be rare, even in real workloads.
That's why it is expectd to reclaim less than expected amount of memory.
Please read the issue finding [5] mail for more details.
So sorry for the confusion.
Corrected Suggestion
====================
A right approach to utilize DAMON for auto-tuned proactive reclamation would be
using 'age_ms' DAMOS fitler [6] instead of the age threshold (--damos_age). It
could be done using DAMON user-sapce tool (damo), like below.
$ sudo ./damo start --monitoring_intervals_autotune \
--damos_action pageout --damos_access_rate 0% 0% \
--damos_filter allow age_ms age 2m max \
--damos_quota_space 128M --damos_quota_interval 1s \
--damos_quota_goal some_mem_psi_us 5000
Note that age_ms DAMOS filter is not yet landed on the mainline Linux kernel.
It is expected to be landed on Linux v7.5. DAMON user-space tool (damo) also
got the support of it starting from v3.4.4.
Using the version of damo, you can also show if your kernel supports age_ms
DAMOS filter or not, like below:
$ sudo ./damo report sysinfo --print_feature_name_only \
--print unavailable_features | grep "sysfs/damos_filter_age_ms"
If the command shows nothing, your kernel supports age_ms DAMOS filter.
If you want to try this by backporting the feature on your kernel and need
help, please feel free to reach out.
Workaround 1: Periodic age threshold update
===========================================
In some cases you might unable to use the age_ms DAMOS filter. As I also
shared on the problem sharing mail [4], you could work around by periodically
refreshing the threshold. Using damo, you could do that like below:
$ sudo ./damo start --monitoring_intervals_autotune \
--damos_action pageout --damos_access_rate 0% 0% \
--damos_age 2m max \
--damos_quota_space 128M --damos_quota_interval 1s \
--damos_quota_goal some_mem_psi_us 5000
$ while :; do \
sudo ./damo tune --monitoring_intervals_autotune \
--damos_action pageout --damos_access_rate 0% 0% \
--damos_age 2m max \
--damos_quota_space 128M --damos_quota_interval 1s \
--damos_quota_goal some_mem_psi_us 5000; \
sleep 300; \
done
The first command starts the auto-tuned proactive reclamation. The second
command starts an infinite loop that adjust the effective coldness threshold
for tuned intervals every 300 seconds.
Note that DAMON user-space tool (damo) of v3.4.6 and earlier versions will not
work as intended with the above example. Those versions will reset the
auto-tuned sampling and aggregation intervals back to the default values (5ms
and 100ms). Hence the coldness threshold is also not properly updated. To use
those versions, users should first see the tuned intervals and manually set
those on periodic update command.
Because that's too cumbersome, I made a change [7] that avoids such unnecessary
reset. With the change, the above example will work. The change will be
included to damo v3.4.7, which will be released tomorrow.
Workaround 2: Small coldness threshold
======================================
The periodic updte might also not feasible for you. In the case, the simplest
workaround would be setting the coldness threshold to small value, like also
mentioned in the issue finding mail [5]. For example, like below.
$ sudo ./damo start --monitoring_intervals_autotune \
--damos_action pageout --damos_access_rate 0% 0% \
--damos_filter allow age_ms age 300ms max \
--damos_quota_space 128M --damos_quota_interval 1s \
--damos_quota_goal some_mem_psi_us 5000
The effective coldness threshold can still be increased, up to 600 seconds. In
usual real world workload, the aggregation interval would converge to 2-20
seconds. The effective coldness threshold in the above example becomes
6-60 seconds. It may look too small threshold. But because it has memory
pressure based coldness threshold auto-tuning, the auto-tuned threshold would
be larger than 6-60 seconds.
Wrapup
======
Do not try the example command for auto-tuned proactive reclamation that I
suggested at OSSummit'26 and offline discussions. Use age_ms DAMOS filter as
explained abovely. Feel free to request porting help if needed. If age_ms
DAMOS filter is not feasible, consider periodic threshold update and small
threshold as workarounds.
Again, sorry for the wrong example command. And I hope the above solution and
workarounds help. Pleae feel free to reach out for any questions and issues.
[1] OSSummit talk: https://sched.co/2RaXh
[2] OSSummit talk video: https://youtu.be/GolUxZZrVsU?si=qdPFE1RZAaNZ0lsY
[3] OSSummit talk slides: https://hosted-files.sched.co/osselceu2026/67/damon_howto.pdf?_gl=1*1dml5iu*_gcl_au*MTM5ODk2ODM5LjE3OTE1Mzg3NDA.*FPAU*MTM5ODk2ODM5LjE3OTE1Mzg3NDA.
[4] https://github.com/damonitor/damo
[5] https://lore.kernel.org/20261121015324.83753-1-sj@kernel.org
[6] https://lore.kernel.org/20261106020559.98352-1-sj@kernel.org
[7] https://github.com/damonitor/damo/commit/9f124c1b95684065128
Thanks,
SJ
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Wrong example command for auto-tuned DAMON-based proactive reclamation, and solution/workarounds
@ 2026-11-30 22:01 Arijit Desai
2026-12-01 2:12 ` SJ Park
0 siblings, 1 reply; 4+ messages in thread
From: Arijit Desai @ 2026-11-30 22:01 UTC (permalink / raw)
To: sj; +Cc: damon, linux-mm, linux-kernel
Hi SJ,
(Replying to https://lore.kernel.org/damon/20261122202258.161562-1-sj@kernel.org/
,
as the original mail did not reach my inbox.)
On Sun, 22 Nov 2026 12:22:57 -0800 SJ Park <sj@kernel.org> wrote:
> A right approach to utilize DAMON for auto-tuned proactive reclamation
> would be using 'age_ms' DAMOS fitler [6] instead of the age threshold
> (--damos_age).
[...]
> Workaround 2: Small coldness threshold
I tested both the age_ms filter and a small coldness threshold on a
vLLM CPU inference workload. Both work as expected. Sharing the
results below.
Setup
=====
- VMs: 16 vCPU, 62 GiB, mm-new 7d1a16abe4cc, 16 GiB swap file, zswap
off.
- Workload: vLLM v0.34.0 CPU, a 3B model in BF16, 8 GiB KV cache. 32
concurrent users, 96 requests, about 1,700 prompt and 256 output
tokens each.
- DAMON (damo 3.4.6): DAMOS pageout on the vLLM worker process, access
rate 0%, intervals auto-tuning, 256 MiB/s space quota, and a
some_mem_psi_us quota goal.
- Setups:
- as-is: --damos_age 2m (converted to 1,200 aggregation intervals),
PSI goal 1 ms/s.
- small threshold: min age of 2 aggregation intervals (set via
sysfs), PSI goal 0.5 ms/s.
- age_ms: min age 0, plus a reject age_ms filter for 0-119,999 ms,
PSI goal 1 ms/s.
- 4 runs per setup. Each change is against no DAMON on the same VM.
Results with MGLRU
==================
as-is small threshold age_ms
output tokens/s +0.2% -0.7% -0.2%
inter-token lat. -0.2% +0.9% +0.3%
worker RSS -0.06G -2.54G -1.80G
swapped out 0.20G 3.13G 1.93G
swapped in 0 0.028G 0.003G
some memory PSI 0 0 0
No DAMON: 26.5 output tokens/s, 18.4 GiB worker RSS.
The small threshold pages out more, but also pages out some memory
that is still used now and then, so ~10x more comes back from swap.
The age_ms filter gets about 70% of the savings at under a third of
the cost.
Memory PSI stayed 0 in every run, even with swap-ins, so the PSI goal
never throttled DAMOS. As far as I can tell, that's because
MADV_PAGEOUT-ed folios under MGLRU don't keep PG_workingset, so their
refaults aren't counted as memory stalls.
Results with the classic LRU
============================
small threshold age_ms
output tokens/s -0.3% -0.1%
inter-token lat. +0.4% +0.1%
worker RSS -1.70G -1.55G
swapped out 1.76G 1.65G
swapped in 0.003G 0.002G
some memory PSI 10-30 ms/run ~20 ms/run
quota at max 24% of time 51% of time
Here the PSI goal works and throttles DAMOS, so the small threshold's
cost drops to about the age_ms filter's level. The age_ms filter does
well with both LRUs, since it doesn't rely on the PSI goal to avoid
hot memory.
Note that "worker RSS" is memory unmapped from the process. Much of it
stays in the swap cache for a while before it is actually freed.
I'm also sending a patch that makes DAMON_RECLAIM apply its min_age
via an age_ms filter, as you suggested.
Thanks,
Arijit
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Wrong example command for auto-tuned DAMON-based proactive reclamation, and solution/workarounds
2026-11-30 22:01 Arijit Desai
@ 2026-12-01 2:12 ` SJ Park
0 siblings, 0 replies; 4+ messages in thread
From: SJ Park @ 2026-12-01 2:12 UTC (permalink / raw)
To: Arijit Desai; +Cc: SJ Park, damon, linux-mm, linux-kernel
Hi Arijit,
On Mon, 30 Nov 2026 14:01:17 -0800 Arijit Desai <arijit.desai@crusoe.ai> wrote:
> Hi SJ,
>
> (Replying to https://lore.kernel.org/damon/20261122202258.161562-1-sj@kernel.org/
> ,
> as the original mail did not reach my inbox.)
>
> On Sun, 22 Nov 2026 12:22:57 -0800 SJ Park <sj@kernel.org> wrote:
[...]
> I tested both the age_ms filter and a small coldness threshold on a
> vLLM CPU inference workload. Both work as expected.
Thank you for sharing the great test results!
[...]
> I'm also sending a patch that makes DAMON_RECLAIM apply its min_age
> via an age_ms filter, as you suggested.
Also appreciate the patch [1]!
[1] https://lore.kernel.org/20261130-damon-reclaim-age-ms-v1-1-595659163211@crusoe.ai
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Wrong example command for auto-tuned DAMON-based proactive reclamation, and solution/workarounds
2026-11-22 20:22 Wrong example command for auto-tuned DAMON-based proactive reclamation, and solution/workarounds SJ Park
@ 2026-12-01 2:13 ` SJ Park
0 siblings, 0 replies; 4+ messages in thread
From: SJ Park @ 2026-12-01 2:13 UTC (permalink / raw)
To: SJ Park; +Cc: damon, linux-mm, linux-kernel, Arijit Desai
On Sun, 22 Nov 2026 12:22:57 -0800 SJ Park <sj@kernel.org> wrote:
> Hello community,
>
>
> I suggested wrong way to utilize DAMON for auto-tuned proactive reclamation.
> Let me explain more details and correct way to do that.
Arijit confirmed [1] the suggested solutions and workarounds work on his test
setup. Please refer to his confirm mail [1] for more details.
[1] https://lore.kernel.org/CAFb32_CXuUi=ntyNqKCS7ZPmqQbayLdHQuFNGgZs=VLxqSHskg@mail.gmail.com
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-12-01 2:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 20:22 Wrong example command for auto-tuned DAMON-based proactive reclamation, and solution/workarounds SJ Park
2026-12-01 2:13 ` SJ Park
-- strict thread matches above, loose matches on Subject: below --
2026-11-30 22:01 Arijit Desai
2026-12-01 2:12 ` SJ Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox