mm/damon/reclaim: enable auto-tuning features by default
Subsystems (4)
SJ Park
maintainercover mm/damon/reclaim: enable auto-tuning features by default
The initial version of DAMON_RECLAIM was supposed to be used after manual tuning of its parameters. Among the parameters, the monitoring intervals (sample_interval and aggr_interval) and the coldness threshold (min_age) are particularly important to be optimally tuned. The optimum values for the parameters tend to be highly dependent on the workload and the system. Hence no small amount of tuning efforts are required to each DAMON_RECLAIM use case.
To reduce the tuning efforts, we recently introduced two auto-tuning features. Intervals auto-tuning (autotune_monitoring_intervals) automatically tunes monitoring intervals to provide practical and efficient monitoring results. PSI-driven quota auto-tuning (quota_autotune_feedback) automatically tunes the coldness threshold.
Because the auto-tuning features were introduced after the initial version, the features are disabled by default. That is to keep the default behaviors unchanged. However, enabling the auto-tuning features is only expected to provide more benefit to the users. Disabling those by default only makes the adoption of the features slow. Also, it is difficult to imagine real users who use DAMON_RECLAIM with its default parameter values.
Enable the auto-tuning features by default. For PSI-driven coldness threshold auto-tuning, set 0.05% memory pressure ratio as the target. Free memory ratio based reclaim watermarks were introduced as a safe guard for unoptimized coldness threshold. Because it is now reasonably auto-tuned, disable the watermark feature by default.
Enable the monitoring intervals auto-tuning and PSI-driven coldness threshold auto-tuning via patches 1 and 2, respectively. Disable the free memory ratio based watermarks via patch 3. Finally update the user document to reflect the changed default values, via patch 4.
SJ Park (4):
mm/damon/reclaim: enable monitoring intervals auto-tune by default mm/damon/reclaim: set memory PSI 0.05% as default quota goal mm/damon/reclaim: disable watermarks by default Docs/admin-guide/mm/damon/reclaim: update for changed default
parameters
Documentation/admin-guide/mm/damon/reclaim.rst | 7 ++++--- mm/damon/reclaim.c | 15 ++++++++------- 2 files changed, 12 insertions(+), 10 deletions(-)
base-commit: 0ec5c1c237bdf91ae93b3efe32767aad9a670f8a
Signature · 1 line
2.47.3
SJ Park
maintainerRFC PATCH 1/4 mm/damon/reclaim: enable monitoring intervals auto-tune by default
DAMON_RECLAIM provides monitoring intervals auto-tuning feature. It is turned off by default, though. It is expected to be only better than the default values of static intervals in real use cases. Enable the auto-tuning.
--- mm/damon/reclaim.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/damon/reclaim.c +2 -2
@@ -98,9 +98,9 @@ module_param(quota_autotune_feedback, ulong, 0600);* sampling intervals 5 milliseconds in minimum, and 10 seconds in maximum. * Setting this to ``N`` disables the auto-tuning. * -* Disabled by default. +* Enabled by default. */ -static bool autotune_monitoring_intervals__read_mostly ; +static bool autotune_monitoring_intervals__read_mostly = true;module_param (autotune_monitoring_intervals, bool,0600 );static struct damos_watermarks damon_reclaim_wmarks = {
Signature · 1 line
2.47.3
SJ Park
maintainerRFC PATCH 2/4 mm/damon/reclaim: set memory PSI 0.05% as default quota goal
In reply to SJ ParkDAMON_RECLAIM provides a PSI-driven quota auto-tuning feature. Because of the DAMOS quota internal access pattern based region prioritization, it means the coldness threshold (min_age) is also auto-tuned. It is tuned off by default, though. The feature is expected to be only better to be enabled. Enable it by default. Set 0.5 milliseconds per second (0.5%) as the default auto-tuning target memory pressure ratio.
--- mm/damon/reclaim.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/damon/reclaim.c +2 -2
@@ -69,9 +69,9 @@ DEFINE_DAMON_MODULES_DAMOS_QUOTAS(damon_reclaim_quota);* compared to this value to see if the aim is satisfied. Value zero means * disabling this auto-tuning feature. * -* Disabled by default. +* 500 microseconds (0.05% of default quota reset interval) by default. */ -static unsigned long quota_mem_pressure_us__read_mostly ; +static unsigned long quota_mem_pressure_us__read_mostly =500 ;module_param (quota_mem_pressure_us, ulong,0600 );/*
Signature · 1 line
2.47.3
SJ Park
maintainerRFC PATCH 3/4 mm/damon/reclaim: disable watermarks by default
In reply to SJ ParkDAMON_RECLAIM's free memory based watermarks features were introduced as a safe guard for wrongly-tuned coldness threshold (min_age). The default watermark values were chosen to let users easily understand how those can be set and tuned. The default values are never meant to be used as are. DAMON_RECLAIM is later updated to enable PSI-driven coldness threshold auto-tuning by default. When the auto-tuning is enabled, having the watermarks with the default values makes no sense. Disable the watermarks by default.
--- mm/damon/reclaim.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
mm/damon/reclaim.c +4 -3
@@ -103,12 +103,13 @@ module_param(quota_autotune_feedback, ulong, 0600);static bool autotune_monitoring_intervals__read_mostly = true;module_param (autotune_monitoring_intervals, bool,0600 ); +/* Watermarks are effectively disabled by default. */ static struct damos_watermarks damon_reclaim_wmarks = { .metric =DAMOS_WMARK_FREE_MEM_RATE , .interval =5000000 ,/* 5 seconds */ - .high =500 ,/* 50 percent */ - .mid =400 ,/* 40 percent */ - .low =200 ,/* 20 percent */ + .high =1000 ,/* 100 percent */ + .mid =1000 ,/* 100 percent */ + .low =0 ,/* 0 percent */ };DEFINE_DAMON_MODULES_WMARKS_PARAMS (damon_reclaim_wmarks);
Signature · 1 line
2.47.3
SJ Park
maintainerRFC PATCH 4/4 Docs/admin-guide/mm/damon/reclaim: update for changed default parameters
In reply to SJ ParkUpdate DAMON_RECLAIM user documentation to reflect the changed default parameter values. Intervals and PSI-driven coldness threshold auto-tuning features are enabled by default. The free memory ratio based watermarks feature is disabled by default.
--- Documentation/admin-guide/mm/damon/reclaim.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
Documentation/admin-guide/mm/damon/reclaim.rst +4 -3
@@ -95,7 +95,7 @@ amount of access events in each DAMON-snapshot, while keeping the sampling interval 5 milliseconds in minimum, and 10 seconds in maximum. Setting this to ``N`` disables the auto-tuning. -Disabled by default. +Enabled by default. quota_ms --------
@@ -145,7 +145,7 @@ per quota reset interval (``quota_reset_interval_ms``) is collected and compared to this value to see if the aim is satisfied. Value zero means disabling this auto-tuning feature. -Disabled by default. +500 microseconds (0.05 percent of default quota reset interval) by default. quota_autotune_feedback -----------------------
@@ -196,7 +196,8 @@ granularity reclamation logic. To keep DAMON_RECLAIM always active regardless of the free memory rate, set ``wmarks_high``, ``wmarks_mid`` and ``wmarks_low`` to ``1000``, ``1000`` and -``0``, respectively. +``0``, respectively. Use of watermarks is not recommended and therefore +disabled by default. sample_interval ---------------
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [RFC PATCH 4/4] Docs/admin-guide/mm/damon/reclaim: update for changed default parameters
Sashiko has reviewed this patch and found no issues.
Quoted 6 lines
Update
DAMON_RECLAIMuser documentation to reflect the changed default parameter values. Intervals and PSI-driven coldness threshold auto-tuning features are enabled by default. The free memory ratio based watermarks feature is disabled by default.Signed-off-by SJ Park <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
[email protected]
AI reviewRe: [RFC PATCH 3/4] mm/damon/reclaim: disable watermarks by default
In reply to SJ ParkSashiko has reviewed this patch and found no issues.
Quoted 10 lines
DAMON_RECLAIM's free memory based watermarks features were introduced as a safe guard for wrongly-tuned coldness threshold (
min_age). The default watermark values were chosen to let users easily understand how those can be set and tuned. The default values are never meant to be used as are.DAMON_RECLAIMis later updated to enable PSI-driven coldness threshold auto-tuning by default. When the auto-tuning is enabled, having the watermarks with the default values makes no sense. Disable the watermarks by default.Signed-off-by SJ Park <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
[email protected]
AI reviewRe: [RFC PATCH 2/4] mm/damon/reclaim: set memory PSI 0.05% as default quota goal
In reply to SJ ParkSashiko has reviewed this patch and found no issues.
Quoted 8 lines
DAMON_RECLAIMprovides a PSI-driven quota auto-tuning feature. Because of the DAMOS quota internal access pattern based region prioritization, it means the coldness threshold (min_age) is also auto-tuned. It is tuned off by default, though. The feature is expected to be only better to be enabled. Enable it by default. Set 0.5 milliseconds per second (0.5%) as the default auto-tuning target memory pressure ratio.Signed-off-by SJ Park <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
[email protected]
AI reviewRe: [RFC PATCH 1/4] mm/damon/reclaim: enable monitoring intervals auto-tune by default
In reply to SJ ParkSashiko has reviewed this patch and found no issues.
Quoted 6 lines
DAMON_RECLAIMprovides monitoring intervals auto-tuning feature. It is turned off by default, though. It is expected to be only better than the default values of static intervals in real use cases. Enable the auto-tuning.Signed-off-by SJ Park <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
SJ Park
maintainerQuoted 22 lines · On Thu, 19 Nov 2026 22:07:34 -0800 SJ Park <[email protected]> wrote:
The initial version of
DAMON_RECLAIMwas supposed to be used after manual tuning of its parameters. Among the parameters, the monitoring intervals (sample_intervalandaggr_interval) and the coldness threshold (min_age) are particularly important to be optimally tuned. The optimum values for the parameters tend to be highly dependent on the workload and the system. Hence no small amount of tuning efforts are required to eachDAMON_RECLAIMuse case.To reduce the tuning efforts, we recently introduced two auto-tuning features. Intervals auto-tuning (
autotune_monitoring_intervals) automatically tunes monitoring intervals to provide practical and efficient monitoring results. PSI-driven quota auto-tuning (quota_autotune_feedback) automatically tunes the coldness threshold.Because the auto-tuning features were introduced after the initial version, the features are disabled by default. That is to keep the default behaviors unchanged. However, enabling the auto-tuning features is only expected to provide more benefit to the users. Disabling those by default only makes the adoption of the features slow. Also, it is difficult to imagine real users who use
DAMON_RECLAIMwith its default parameter values.
Quoted 1 line
Enable the auto-tuning features by default.
My colleague, Arijit, found this is not a good idea. He is now working on proving the theory and making a patch.
DAMON_RECLAIM receives the coldness throughput via 'min_age' parameter, which has 2 minutes as the default value. DAMON_RECLAIM converts that into the number of aggregation intervals for the time, and set it as the min_age_region of the damos_access_pattern for its reclamation DAMOS scheme. DAMON_RECLAIM does the conversion when it starts working, or a parameter is updated online, using commit_inputs parameter. It doesn't update the min_age_region value when the aggregation interval is auto-tuned.
This patchset enables the intervals auto-tuning features so that the aggregation intervals span from 100 milliseconds to 200 seconds (up to 2,000 x). As a result, the effective min_age can span from 2 minutes to 4,000 minutes.
In usual real workload, the auto-tuning converges the aggregation interval to a few seconds (20-200x). The effective min_age will be about 40 minutes to 400 minutes. Even on long term real world workload, that could be too much threshold. The user will show DAMON_RECLAIM is reclaiming only unexpectedly small amount of memory.
PSI-driven coldness threshold auto-tuning can make the effective min_age only longer, so it doesn't help.
One strightforward workaround would be setting the min_age a small value, like 2-4 aggregation intervals (200-400 milliseconds). Then, in usual case, the effective min_age becomes 4 seconds to 40 seconds. It might feel like too small threshold. PSI-driven coldness threshold auto-tuning will make it better.
Yet another workaround would be monitoring the auto-tuned interval and update the min_age online, using the commit_inputs parameter.
We introduced age_ms DAMOS filter type [1] to fix this kind of issue. Long term solution for DAMON_RECLAIM would be modifying it to use the age_ms DAMOS filter instead of the aggregation interval based min_age_region.
My colleague, Arijit, is working on the long term solution. Until it is arrived, I will keep the RFC tag of this patch series.
[1] https://lore.kernel.org/[email protected]
Thanks,
SJ
[...]
Re: [RFC PATCH 2/4] mm/damon/reclaim: set memory PSI 0.05% as default quota goal
In reply to SJ ParkHi SJ,
Quoted 2 lines · On Thu, 19 Nov 2026 22:07:36 -0800 SJ Park wrote:
Set 0.5 milliseconds per second
(0.5%) as the default auto-tuning target memory pressure ratio.
0.5 ms per second comes out to 0.05%.
Quoted 1 line
+static unsigned long
quota_mem_pressure_us__read_mostly= 500;
With a fixed 500 us target, maybe a longer aggregation interval also lengthen the PSI measurement window. For example, if the quota ends up being reset every 2 s, should 1000 us of stalls still be compared against 500 us? If so, the tuner would drop the effective quota to 1 byte, skipping pageout for the next quota window.
Thanks,
Aveline Noir
SJ Park
maintainerRe: [RFC PATCH 2/4] mm/damon/reclaim: set memory PSI 0.05% as default quota goal
Hi Aveline,
Quoted 9 lines · On Sat, 21 Nov 2026 23:39:16 +1100 Aveline Noir <[email protected]> wrote:
Hi SJ,
Quoted 2 lines · On Thu, 19 Nov 2026 22:07:36 -0800 SJ Park wrote:
Set 0.5 milliseconds per second
(0.5%) as the default auto-tuning target memory pressure ratio.0.5 ms per second comes out to 0.05%.
Quoted 7 lines
Quoted 1 line
+static unsigned long
quota_mem_pressure_us__read_mostly= 500;With a fixed 500 us target, maybe a longer aggregation interval also lengthen the PSI measurement window. For example, if the quota ends up being reset every 2 s, should 1000 us of stalls still be compared against 500 us? If so, the tuner would drop the effective quota to 1 byte, skipping pageout for the next quota window.
DAMOS quota is not reset for aggregation interval. It has a separate interval for quota reset. It is exposed to users via quotqa_reset_interval_ms parameter. The default value is 1 second.
The quota reset interval is evaluated for every sampling interval, though. If the sampling interval is tuned to be larger than 1 second, the problem Aveline mentioned could happen.
But, I'm not sure if it could be a real problem. Reclaiming more than expected is a definite problem that can degrade the system performance. Reclaiming less than expected is less concerning, as long as the extent is not too much. It doesn't regress something. Anyway this is a best effort proactive reclamation.
We could revisit this if it becomes clear some real users find it as a problem.
Thanks,
SJ
[...]