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/core: introduce DAMOS_QUOTA_GOAL_TUNER_TEMPORAL

Introduce a new goal-based DAMOS quota auto-tuning algorithm, namely
DAMOS_QUOTA_GOAL_TUNER_TEMPORAL (temporal in short). The algorithm aims
to trigger the DAMOS action only for a temporal time, to achieve the goal
as soon as possible. For the temporal period, it uses as much quota as
allowed. Once the goal is achieved, it sets the quota zero, so
effectively makes the scheme be deactivated.

Link: https://lkml.kernel.org/r/20260310010529.91162-4-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

SeongJae Park and committed by
Andrew Morton
af738a6a 54419bbd

+26 -5
+2
include/linux/damon.h
··· 218 218 /** 219 219 * enum damos_quota_goal_tuner - Goal-based quota tuning logic. 220 220 * @DAMOS_QUOTA_GOAL_TUNER_CONSIST: Aim long term consistent quota. 221 + * @DAMOS_QUOTA_GOAL_TUNER_TEMPORAL: Aim zero quota asap. 221 222 */ 222 223 enum damos_quota_goal_tuner { 223 224 DAMOS_QUOTA_GOAL_TUNER_CONSIST, 225 + DAMOS_QUOTA_GOAL_TUNER_TEMPORAL, 224 226 }; 225 227 226 228 /**
+24 -5
mm/damon/core.c
··· 2347 2347 return highest_score; 2348 2348 } 2349 2349 2350 + static void damos_goal_tune_esz_bp_consist(struct damos_quota *quota) 2351 + { 2352 + unsigned long score = damos_quota_score(quota); 2353 + 2354 + quota->esz_bp = damon_feed_loop_next_input( 2355 + max(quota->esz_bp, 10000UL), score); 2356 + } 2357 + 2358 + static void damos_goal_tune_esz_bp_temporal(struct damos_quota *quota) 2359 + { 2360 + unsigned long score = damos_quota_score(quota); 2361 + 2362 + if (score >= 10000) 2363 + quota->esz_bp = 0; 2364 + else if (quota->sz) 2365 + quota->esz_bp = quota->sz * 10000; 2366 + else 2367 + quota->esz_bp = ULONG_MAX; 2368 + } 2369 + 2350 2370 /* 2351 2371 * Called only if quota->ms, or quota->sz are set, or quota->goals is not empty 2352 2372 */ ··· 2381 2361 } 2382 2362 2383 2363 if (!list_empty(&quota->goals)) { 2384 - unsigned long score = damos_quota_score(quota); 2385 - 2386 - quota->esz_bp = damon_feed_loop_next_input( 2387 - max(quota->esz_bp, 10000UL), 2388 - score); 2364 + if (quota->goal_tuner == DAMOS_QUOTA_GOAL_TUNER_CONSIST) 2365 + damos_goal_tune_esz_bp_consist(quota); 2366 + else if (quota->goal_tuner == DAMOS_QUOTA_GOAL_TUNER_TEMPORAL) 2367 + damos_goal_tune_esz_bp_temporal(quota); 2389 2368 esz = quota->esz_bp / 10000; 2390 2369 } 2391 2370