mirror of
https://github.com/torvalds/linux
synced 2024-10-14 23:39:09 +00:00
mm/damon/reclaim: implement memory PSI-driven quota self-tuning
Support the PSI-driven quota self-tuning from DAMON_RECLAIM by introducing yet another parameter, 'quota_mem_pressure_us'. Users can set the desired amount of memory pressure stall time per each quota reset interval using the parameter. Then DAMON_RECLAIM monitor the memory pressure stall time, specifically system-wide memory 'some' PSI value that increased during the given time interval, and self-tune the quota using the DAMOS core logic. Link: https://lkml.kernel.org/r/20240219194431.159606-20-sj@kernel.org Signed-off-by: SeongJae Park <sj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
58dea17d7a
commit
7ce55f8ffd
|
@ -62,6 +62,21 @@ static struct damos_quota damon_reclaim_quota = {
|
||||||
};
|
};
|
||||||
DEFINE_DAMON_MODULES_DAMOS_QUOTAS(damon_reclaim_quota);
|
DEFINE_DAMON_MODULES_DAMOS_QUOTAS(damon_reclaim_quota);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Desired level of memory pressure-stall time in microseconds.
|
||||||
|
*
|
||||||
|
* While keeping the caps that set by other quotas, DAMON_RECLAIM automatically
|
||||||
|
* increases and decreases the effective level of the quota aiming this level of
|
||||||
|
* memory pressure is incurred. System-wide ``some`` memory PSI in microseconds
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
static unsigned long quota_mem_pressure_us __read_mostly;
|
||||||
|
module_param(quota_mem_pressure_us, ulong, 0600);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* User-specifiable feedback for auto-tuning of the effective quota.
|
* User-specifiable feedback for auto-tuning of the effective quota.
|
||||||
*
|
*
|
||||||
|
@ -198,6 +213,16 @@ static int damon_reclaim_apply_parameters(void)
|
||||||
&old_scheme->quota);
|
&old_scheme->quota);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (quota_mem_pressure_us) {
|
||||||
|
goal = damos_new_quota_goal(DAMOS_QUOTA_SOME_MEM_PSI_US,
|
||||||
|
quota_mem_pressure_us);
|
||||||
|
if (!goal) {
|
||||||
|
damon_destroy_scheme(scheme);
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
damos_add_quota_goal(&scheme->quota, goal);
|
||||||
|
}
|
||||||
|
|
||||||
if (quota_autotune_feedback) {
|
if (quota_autotune_feedback) {
|
||||||
goal = damos_new_quota_goal(DAMOS_QUOTA_USER_INPUT, 10000);
|
goal = damos_new_quota_goal(DAMOS_QUOTA_USER_INPUT, 10000);
|
||||||
if (!goal) {
|
if (!goal) {
|
||||||
|
|
Loading…
Reference in a new issue