Skip to content

Commit 8e1c496

Browse files
mitaakpm00
authored andcommitted
mm/damon/core: avoid destroyed target reference from DAMOS quota
When the number of the monitoring targets in running contexts is reduced, there may be DAMOS quotas referencing the targets that will be destroyed. Applying the scheme action for such DAMOS scheme will be skipped forever looking for the starting part of the region for the destroyed monitoring target. To fix this issue, when the monitoring target is destroyed, reset the starting part for all DAMOS quotas that reference the target. Link: https://lkml.kernel.org/r/20250517141852.142802-1-akinobu.mita@gmail.com Fixes: da87878 ("mm/damon/sysfs: support online inputs update") Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Reviewed-by: SeongJae Park <sj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 3ac4638 commit 8e1c496

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

mm/damon/core.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,9 +1093,17 @@ static int damon_commit_targets(
10931093
if (err)
10941094
return err;
10951095
} else {
1096+
struct damos *s;
1097+
10961098
if (damon_target_has_pid(dst))
10971099
put_pid(dst_target->pid);
10981100
damon_destroy_target(dst_target);
1101+
damon_for_each_scheme(s, dst) {
1102+
if (s->quota.charge_target_from == dst_target) {
1103+
s->quota.charge_target_from = NULL;
1104+
s->quota.charge_addr_from = 0;
1105+
}
1106+
}
10991107
}
11001108
}
11011109

0 commit comments

Comments
 (0)