Skip to content

Commit 8e7bde6

Browse files
sjp38akpm00
authored andcommitted
mm/damon/core: handle zero schemes apply interval
DAMON's logics to determine if this is the time to apply damos schemes assumes next_apply_sis is always set larger than current passed_sample_intervals. And therefore assume continuously incrementing passed_sample_intervals will make it reaches to the next_apply_sis in future. The logic hence does apply the scheme and update next_apply_sis only if passed_sample_intervals is same to next_apply_sis. If Schemes apply interval is set as zero, however, next_apply_sis is set same to current passed_sample_intervals, respectively. And passed_sample_intervals is incremented before doing the next_apply_sis check. Hence, next_apply_sis becomes larger than next_apply_sis, and the logic says it is not the time to apply schemes and update next_apply_sis. In other words, DAMON stops applying schemes until passed_sample_intervals overflows. Based on the documents and the common sense, a reasonable behavior for such inputs would be applying the schemes for every sampling interval. Handle the case by removing the assumption. Link: https://lkml.kernel.org/r/[email protected] Fixes: 42f994b ("mm/damon/core: implement scheme-specific apply interval") Signed-off-by: SeongJae Park <[email protected]> Cc: <[email protected]> [6.7.x] Signed-off-by: Andrew Morton <[email protected]>
1 parent 3488af0 commit 8e7bde6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mm/damon/core.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,7 +1412,7 @@ static void damon_do_apply_schemes(struct damon_ctx *c,
14121412
damon_for_each_scheme(s, c) {
14131413
struct damos_quota *quota = &s->quota;
14141414

1415-
if (c->passed_sample_intervals != s->next_apply_sis)
1415+
if (c->passed_sample_intervals < s->next_apply_sis)
14161416
continue;
14171417

14181418
if (!s->wmarks.activated)
@@ -1622,7 +1622,7 @@ static void kdamond_apply_schemes(struct damon_ctx *c)
16221622
bool has_schemes_to_apply = false;
16231623

16241624
damon_for_each_scheme(s, c) {
1625-
if (c->passed_sample_intervals != s->next_apply_sis)
1625+
if (c->passed_sample_intervals < s->next_apply_sis)
16261626
continue;
16271627

16281628
if (!s->wmarks.activated)
@@ -1642,9 +1642,9 @@ static void kdamond_apply_schemes(struct damon_ctx *c)
16421642
}
16431643

16441644
damon_for_each_scheme(s, c) {
1645-
if (c->passed_sample_intervals != s->next_apply_sis)
1645+
if (c->passed_sample_intervals < s->next_apply_sis)
16461646
continue;
1647-
s->next_apply_sis +=
1647+
s->next_apply_sis = c->passed_sample_intervals +
16481648
(s->apply_interval_us ? s->apply_interval_us :
16491649
c->attrs.aggr_interval) / sample_interval;
16501650
}

0 commit comments

Comments
 (0)