diff options
author | Jiri Kosina <jkosina@suse.cz> | 2023-04-26 23:52:34 +0300 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2023-04-26 23:52:34 +0300 |
commit | cdc780f044a803aff8845b949f800f0f3d095d5f (patch) | |
tree | 6695a80568f6b4aef414070f17859f434e229957 /mm/damon/reclaim.c | |
parent | 38518593ec55e897abda4b4be77b2ec8ec4447d1 (diff) | |
parent | 37386669887d3f2ccf021322c5558353d20f2387 (diff) | |
download | linux-cdc780f044a803aff8845b949f800f0f3d095d5f.tar.xz |
Merge branch 'for-6.4/amd-sfh' into for-linus
- assorted functional fixes for amd-sfh driver (Basavaraj Natikar)
Diffstat (limited to 'mm/damon/reclaim.c')
-rw-r--r-- | mm/damon/reclaim.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/mm/damon/reclaim.c b/mm/damon/reclaim.c index e82631f39481..648d2a85523a 100644 --- a/mm/damon/reclaim.c +++ b/mm/damon/reclaim.c @@ -99,6 +99,15 @@ static unsigned long monitor_region_end __read_mostly; module_param(monitor_region_end, ulong, 0600); /* + * Skip anonymous pages reclamation. + * + * If this parameter is set as ``Y``, DAMON_RECLAIM does not reclaim anonymous + * pages. By default, ``N``. + */ +static bool skip_anon __read_mostly; +module_param(skip_anon, bool, 0600); + +/* * PID of the DAMON thread * * If DAMON_RECLAIM is enabled, this becomes the PID of the worker thread. @@ -142,6 +151,7 @@ static struct damos *damon_reclaim_new_scheme(void) static int damon_reclaim_apply_parameters(void) { struct damos *scheme; + struct damos_filter *filter; int err = 0; err = damon_set_attrs(ctx, &damon_reclaim_mon_attrs); @@ -152,6 +162,15 @@ static int damon_reclaim_apply_parameters(void) scheme = damon_reclaim_new_scheme(); if (!scheme) return -ENOMEM; + if (skip_anon) { + filter = damos_new_filter(DAMOS_FILTER_TYPE_ANON, true); + if (!filter) { + /* Will be freed by next 'damon_set_schemes()' below */ + damon_destroy_scheme(scheme); + return -ENOMEM; + } + damos_add_filter(scheme, filter); + } damon_set_schemes(ctx, &scheme, 1); return damon_set_region_biggest_system_ram_default(target, |