linux/mm/damon
SeongJae Park e35afdf228 mm/damon/sysfs: implement obsolete_target file
There is no good way to remove DAMON targets in the middle of the existing
targets list.  It restricts efficient and flexible DAMON use cases. 
Improve the usability by implementing a new DAMON sysfs interface file,
namely obsolete_target, under each target directory.  It is connected to
the obsolete field of parameters commit-source targets, so allows removing
arbitrary targets in the middle of existing targets list.

Note that the sysfs files are not automatically updated.  For example,
let's suppose there are three targets in the running context, and a user
removes the third target using this feature.  If the user writes 'commit'
to the kdamond 'state' file again, DAMON sysfs interface will again try to
remove the third target.  But because there is no matching target in the
running context, the commit will fail.  It is the user's responsibility to
understand resulting DAMON internal targets list change, and construct
sysfs files (using nr_targets and other sysfs files) to correctly
represent it.

Also note that this is arguably an improvement rather than a fix of broken
things.

Link: https://lkml.kernel.org/r/20251023012535.69625-4-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Reported-by: Bijan Tabatabai <bijan311@gmail.com>
Closes: https://github.com/damonitor/damo/issues/36
Reviewed-by: Bijan Tabatabai <bijan311@gmail.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-11-16 17:28:23 -08:00
..
tests mm/damon: add damon_ctx->min_sz_region 2025-09-13 16:55:24 -07:00
core.c mm/damon/core: add damon_target->obsolete for pin-point removal 2025-11-16 17:28:23 -08:00
Kconfig mm/damon/Kconfig: make DAMON_STAT_ENABLED_DEFAULT depend on DAMON_STAT 2025-09-13 16:55:07 -07:00
lru_sort.c mm/damon: add a min_sz_region parameter to damon_set_region_biggest_system_ram_default() 2025-11-16 17:28:09 -08:00
Makefile mm/damon: introduce DAMON_STAT module 2025-07-09 22:41:55 -07:00
modules-common.c mm/damon: s/primitives/code/ on comments 2025-06-05 21:55:41 -07:00
modules-common.h mm/damon: s/primitives/code/ on comments 2025-06-05 21:55:41 -07:00
ops-common.c mm: always call rmap_walk() on locked folios 2025-11-16 17:28:00 -08:00
ops-common.h mm/damon/paddr: move filters existence check function to ops-common 2025-09-13 16:54:47 -07:00
paddr.c mm/damon/paddr: support addr_unit for DAMOS_STAT 2025-09-13 16:55:23 -07:00
reclaim.c mm/damon/reclaim: use min_sz_region for core address alignment when setting regions 2025-11-16 17:28:10 -08:00
stat.c mm/damon: add a min_sz_region parameter to damon_set_region_biggest_system_ram_default() 2025-11-16 17:28:09 -08:00
sysfs-common.c mm/damon: s/primitives/code/ on comments 2025-06-05 21:55:41 -07:00
sysfs-common.h mm/damon: s/primitives/code/ on comments 2025-06-05 21:55:41 -07:00
sysfs-schemes.c mm/damon/sysfs: remove misleading todo comment in nid_show() 2025-11-16 17:28:14 -08:00
sysfs.c mm/damon/sysfs: implement obsolete_target file 2025-11-16 17:28:23 -08:00
vaddr.c mm/damon/vaddr: do not repeat pte_offset_map_lock() until success 2025-10-07 14:01:12 -07:00