Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/damon/lru_sort: add monitoring intervals auto-tuning parameter

DAMON monitoring intervals tuning was crucial for every DAMON use case.
Now there are a tuning guideline and an automated intervals tuning
feature. DAMON_LRU_SORT is still using manual control of intervals. Add
a module parameter for utilizing the auto-tuning feature with a suggested
auto-tuning parameters.

Link: https://lkml.kernel.org/r/20260113152717.70459-11-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Acked-by: wang lian <lianux.mm@gmail.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

SeongJae Park and committed by
Andrew Morton
4bdd6922 cdfca22d

+27 -3
+27 -3
mm/damon/lru_sort.c
··· 56 56 module_param(active_mem_bp, ulong, 0600); 57 57 58 58 /* 59 + * Auto-tune monitoring intervals. 60 + * 61 + * If this parameter is set as ``Y``, DAMON_LRU_SORT automatically tunes 62 + * DAMON's sampling and aggregation intervals. The auto-tuning aims to capture 63 + * meaningful amount of access events in each DAMON-snapshot, while keeping the 64 + * sampling interval 5 milliseconds in minimum, and 10 seconds in maximum. 65 + * Setting this as ``N`` disables the auto-tuning. 66 + * 67 + * Disabled by default. 68 + */ 69 + static bool autotune_monitoring_intervals __read_mostly; 70 + module_param(autotune_monitoring_intervals, bool, 0600); 71 + 72 + /* 59 73 * Filter [non-]young pages accordingly for LRU [de]prioritizations. 60 74 * 61 75 * If this is set, check page level access (youngness) once again before each ··· 282 268 { 283 269 struct damon_ctx *param_ctx; 284 270 struct damon_target *param_target; 271 + struct damon_attrs attrs; 285 272 struct damos *hot_scheme, *cold_scheme; 286 273 unsigned int hot_thres, cold_thres; 287 274 int err; ··· 305 290 goto out; 306 291 } 307 292 308 - err = damon_set_attrs(param_ctx, &damon_lru_sort_mon_attrs); 293 + attrs = damon_lru_sort_mon_attrs; 294 + if (autotune_monitoring_intervals) { 295 + attrs.sample_interval = 5000; 296 + attrs.aggr_interval = 100000; 297 + attrs.intervals_goal.access_bp = 40; 298 + attrs.intervals_goal.aggrs = 3; 299 + attrs.intervals_goal.min_sample_us = 5000; 300 + attrs.intervals_goal.max_sample_us = 10 * 1000 * 1000; 301 + } 302 + err = damon_set_attrs(param_ctx, &attrs); 309 303 if (err) 310 304 goto out; 311 305 312 306 err = -ENOMEM; 313 - hot_thres = damon_max_nr_accesses(&damon_lru_sort_mon_attrs) * 307 + hot_thres = damon_max_nr_accesses(&attrs) * 314 308 hot_thres_access_freq / 1000; 315 309 hot_scheme = damon_lru_sort_new_hot_scheme(hot_thres); 316 310 if (!hot_scheme) 317 311 goto out; 318 312 319 - cold_thres = cold_min_age / damon_lru_sort_mon_attrs.aggr_interval; 313 + cold_thres = cold_min_age / attrs.aggr_interval; 320 314 cold_scheme = damon_lru_sort_new_cold_scheme(cold_thres); 321 315 if (!cold_scheme) { 322 316 damon_destroy_scheme(hot_scheme);