mm/damon/core: avoid destroyed target reference from DAMOS quota
authorAkinobu Mita <akinobu.mita@gmail.com>
Sat, 17 May 2025 14:18:52 +0000 (23:18 +0900)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 1 Jun 2025 05:46:09 +0000 (22:46 -0700)
commit8e1c4961f44be6172553c062d8f425a4a4357afa
treeadfec869924f7f1ad90a70638a10c16ec8b7e8e2
parent3ac4638a734abbeb1d4a02b042e26a80a4205975
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: da87878010e5 ("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>
mm/damon/core.c