[RFC PATCH 0/3] mm/damon: fix three race bugs in sysfs and core

From: SJ Park

Date: Sat Oct 24 2026 - 15:35:09 EST


There are three race condition bugs in DAMON sysfs interface and the
core layer. User impacts are not critical but better to fix sooner than
later.

Patch 1 fixes a toctou bug in DAMON sysfs interface that can mess up
DAMOS auto-tuning. Patches 2 and 3 move static variables that can be
wrongly shared with multiple kdamonds and therefore make DAMON
monitoring results be a little more indeterministic.

Note for Andrew. These are not urgent but better to take the hotfix
track in my humble opinion.

SJ Park (3):
mm/damon/sysfs-schemes: hold damon_sysfs_lock in target_metric_store()
mm/damon/core: move static variable last_nr_regions to damon_ctx
mm/damon/core: move static variable rotation to damon_ctx

include/linux/damon.h | 10 ++++++++++
mm/damon/core.c | 10 +++++-----
mm/damon/sysfs-schemes.c | 3 +++
3 files changed, 18 insertions(+), 5 deletions(-)


base-commit: f390255d9de653f4e7a9bae8c9a5ad881ad25a87
--
2.47.3