Skip to content

Commit e9e3db6

Browse files
sjp38akpm00
authored andcommitted
mm/damon/core: check apply interval in damon_do_apply_schemes()
kdamond_apply_schemes() checks apply intervals of schemes and avoid further applying any schemes if no scheme passed its apply interval. However, the following schemes applying function, damon_do_apply_schemes() iterates all schemes without the apply interval check. As a result, the shortest apply interval is applied to all schemes. Fix the problem by checking the apply interval in damon_do_apply_schemes(). Link: https://lkml.kernel.org/r/20240205201306.88562-1-sj@kernel.org Fixes: 42f994b ("mm/damon/core: implement scheme-specific apply interval") Signed-off-by: SeongJae Park <sj@kernel.org> Cc: <stable@vger.kernel.org> [6.7.x] Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent e3b63e9 commit e9e3db6

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

mm/damon/core.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,9 @@ static void damon_do_apply_schemes(struct damon_ctx *c,
10261026
damon_for_each_scheme(s, c) {
10271027
struct damos_quota *quota = &s->quota;
10281028

1029+
if (c->passed_sample_intervals != s->next_apply_sis)
1030+
continue;
1031+
10291032
if (!s->wmarks.activated)
10301033
continue;
10311034

@@ -1176,10 +1179,6 @@ static void kdamond_apply_schemes(struct damon_ctx *c)
11761179
if (c->passed_sample_intervals != s->next_apply_sis)
11771180
continue;
11781181

1179-
s->next_apply_sis +=
1180-
(s->apply_interval_us ? s->apply_interval_us :
1181-
c->attrs.aggr_interval) / sample_interval;
1182-
11831182
if (!s->wmarks.activated)
11841183
continue;
11851184

@@ -1195,6 +1194,14 @@ static void kdamond_apply_schemes(struct damon_ctx *c)
11951194
damon_for_each_region_safe(r, next_r, t)
11961195
damon_do_apply_schemes(c, t, r);
11971196
}
1197+
1198+
damon_for_each_scheme(s, c) {
1199+
if (c->passed_sample_intervals != s->next_apply_sis)
1200+
continue;
1201+
s->next_apply_sis +=
1202+
(s->apply_interval_us ? s->apply_interval_us :
1203+
c->attrs.aggr_interval) / sample_interval;
1204+
}
11981205
}
11991206

12001207
/*

0 commit comments

Comments
 (0)