linux/mm/damon
SJ Park 5695abc4e7 mm/damon/core: remove unreachable damos charge_{target,addr}_from
damos_quota->charge_{target,addr}_from saves the target and region the
scheme's quota limit is reached.  damos_skip_charged_region() skips the
target and regions before the point.  The target that was assigned to
charge_target_from could be dynamically removed from the context by the
runtime parameters update (aka commit) feature.  In this case,
damos_skip_charged_region() cannot find if the point is passed or not,
so the scheme is effectively disabled.

Similarly, the user could also remove all the regions of the target
using the runtime parameters update feature.  It would be uncommon to do
that, but it is a supported feature.  Because the skip pointer detection
logic (damos_skip_charged_region()) works for each region of targets,
this result in the logic is entirely skipped and the scheme is
effectively disabled again.

The user impact is that the DAMOS scheme could suddenly stop working
under certain uses of the runtime parameters update feature.  It could
surprise users. No crash or leak happens though.  Users could also
simply work around by re-installing the scheme.

Catch the corner cases in damos_adjust_quota() and reset the pointers.

Link: https://lore.kernel.org/20261020023958.108276-1-sj@kernel.org
Fixes: da87878010 ("mm/damon/sysfs: support online inputs update")
Signed-off-by: SJ Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Closes: https://sashiko.dev/#/bug/linux-cd0c55fc-0cc8-45d8-9637-3334811c49b8
Cc: <stable@vger.kernel.org> # 5.19.x
2026-10-24 01:56:41 -07:00
..
tests mm/damon/core: filter out damos address filter-split failed region 2026-10-24 01:56:40 -07:00
core.c mm/damon/core: remove unreachable damos charge_{target,addr}_from 2026-10-24 01:56:41 -07:00
Kconfig mm/damon: add CONFIG_DAMON_DEBUG_SANITY 2026-04-05 13:53:20 -07:00
lru_sort.c mm/damon/core: add complement argument to damos_new_quota_goal() 2026-10-24 01:56:01 -07:00
Makefile mm/damon: introduce DAMON_STAT module 2025-07-09 22:41:55 -07:00
modules-common.c MAINTAINERS: s/SeongJae/SJ/ 2026-07-09 15:48:53 -07:00
modules-common.h MAINTAINERS: s/SeongJae/SJ/ 2026-07-09 15:48:53 -07:00
ops-common.c mm/damon: use damon_get_monitor_folio() for hugetlb entries 2026-10-24 01:56:26 -07:00
ops-common.h mm/damon/paddr: move probe filter handling to ops-common 2026-10-08 22:54:54 -07:00
paddr.c mm/damon/paddr: remove pa parameter from damon_pa_filter_pass() 2026-10-12 21:26:23 -07:00
reclaim.c mm/damon/core: add complement argument to damos_new_quota_goal() 2026-10-24 01:56:01 -07:00
stat.c mm/damon/stat: use secs_to_jiffies() instead of msecs_to_jiffies() 2026-07-30 19:40:21 -07:00
sysfs-common.c MAINTAINERS: s/SeongJae/SJ/ 2026-07-09 15:48:53 -07:00
sysfs-common.h MAINTAINERS: s/SeongJae/SJ/ 2026-07-09 15:48:53 -07:00
sysfs-schemes.c mm/damon/sysfs-schemes: support quota goal complement flag 2026-10-24 01:56:02 -07:00
sysfs.c mm/damon/sysfs: propagate damon_call() error in turn_damon_on 2026-10-12 21:26:38 -07:00
vaddr.c mm/damon: use damon_get_monitor_folio() for hugetlb entries 2026-10-24 01:56:26 -07:00