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: 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: 42f994b71404 ("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>

authored by

SeongJae Park and committed by
Andrew Morton
e9e3db69 e3b63e96

+11 -4
+11 -4
mm/damon/core.c
··· 1026 1026 damon_for_each_scheme(s, c) { 1027 1027 struct damos_quota *quota = &s->quota; 1028 1028 1029 + if (c->passed_sample_intervals != s->next_apply_sis) 1030 + continue; 1031 + 1029 1032 if (!s->wmarks.activated) 1030 1033 continue; 1031 1034 ··· 1179 1176 if (c->passed_sample_intervals != s->next_apply_sis) 1180 1177 continue; 1181 1178 1182 - s->next_apply_sis += 1183 - (s->apply_interval_us ? s->apply_interval_us : 1184 - c->attrs.aggr_interval) / sample_interval; 1185 - 1186 1179 if (!s->wmarks.activated) 1187 1180 continue; 1188 1181 ··· 1193 1194 damon_for_each_target(t, c) { 1194 1195 damon_for_each_region_safe(r, next_r, t) 1195 1196 damon_do_apply_schemes(c, t, r); 1197 + } 1198 + 1199 + damon_for_each_scheme(s, c) { 1200 + if (c->passed_sample_intervals != s->next_apply_sis) 1201 + continue; 1202 + s->next_apply_sis += 1203 + (s->apply_interval_us ? s->apply_interval_us : 1204 + c->attrs.aggr_interval) / sample_interval; 1196 1205 } 1197 1206 } 1198 1207