summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEnze Li <lienze@kylinos.cn>2025-12-10 08:25:08 +0300
committerAndrew Morton <akpm@linux-foundation.org>2026-01-21 06:24:42 +0300
commit6e4930e33329eec80dd245f28b52202271f5fb28 (patch)
tree9f4e752353694f373bb08b5b82147773be1f4b07 /include
parent16cc8b9396f6d63c1331059d67626cf907a7f23c (diff)
downloadlinux-6e4930e33329eec80dd245f28b52202271f5fb28.tar.xz
mm/damon/core: fix wasteful CPU calls by skipping non-existent targets
Currently, DAMON does not proactively clean up invalid monitoring targets during its runtime. When some monitored processes exit, DAMON continues to make the following unnecessary function calls, --damon_for_each_target-- --damon_for_each_region-- damon_do_apply_schemes damos_apply_scheme damon_va_apply_scheme damos_madvise damon_get_mm it is only in the damon_get_mm() function that it may finally discover the target no longer exists, which wastes CPU resources. A simple idea is to check for the existence of monitoring targets within the kdamond_need_stop() function and promptly clean up non-existent targets. However, SJ pointed out that this approach is problematic because the online commit logic incorrectly uses list indices to update the monitoring state. This can lead to data loss if the target list is changed concurrently. Meanwhile, SJ suggests checking for target existence at the damon_for_each_target level, and if a target does not exist, simply skip it and proceed to the next one. Link: https://lkml.kernel.org/r/20251210052508.264433-1-lienze@kylinos.cn Signed-off-by: Enze Li <lienze@kylinos.cn> Suggested-by: SeongJae Park <sj@kernel.org> Reviewed-by: SeongJae Park <sj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions