linux/mm/damon
SeongJae Park 73d7a69de2 mm/damon/core: initialize damos->walk_completed in damon_new_scheme()
The function for allocating and initialize a 'struct damos' object,
damon_new_scheme(), is not initializing damos->walk_completed field.  Only
damos_walk_complete() is setting the field.  Hence the field will be
eventually set and used correctly from second damos_walk() call for the
scheme.  But the first damos_walk() could mistakenly not walk on the
regions.  Actually, a common usage of DAMOS for taking an access pattern
snapshot is installing a monitoring-purpose DAMOS scheme, doing
damos_walk() to retrieve the snapshot, and then removing the scheme. 
DAMON user-space tool (damo) also gets runtime snapshot in the way.  Hence
the problem can continuously happen in such use cases.  Initialize it
properly in the allocation function.

Link: https://lkml.kernel.org/r/20250228174450.41472-1-sj@kernel.org
Fixes: bf0eaba0ff ("mm/damon/core: implement damos_walk()")
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-03-16 17:40:23 -07:00
..
tests mm/damon: add 'allow' argument to damos_new_filter() 2025-01-25 20:22:32 -08:00
core.c mm/damon/core: initialize damos->walk_completed in damon_new_scheme() 2025-03-16 17:40:23 -07:00
Kconfig mm/damon: remove DAMON debugfs interface 2025-01-25 20:22:29 -08:00
lru_sort.c Revert "mm/damon/lru_sort: adjust local variable to dynamic allocation" 2024-09-09 16:39:00 -07:00
Makefile mm/damon: remove DAMON debugfs interface 2025-01-25 20:22:29 -08:00
modules-common.c mm/damon: update email of SeongJae 2023-12-20 14:48:13 -08:00
modules-common.h mm/damon/modules: deduplicate init steps for DAMON context setup 2022-11-30 15:01:26 -08:00
ops-common.c mm/damon/ops-common: avoid divide-by-zero during region hotness calculation 2023-10-25 16:47:15 -07:00
ops-common.h mm/damon/ops-common: atomically test and clear young on ptes and pmds 2023-06-09 16:25:55 -07:00
paddr.c mm/damon: respect core layer filters' allowance decision on ops layer 2025-03-16 17:40:23 -07:00
reclaim.c mm/damon: add 'allow' argument to damos_new_filter() 2025-01-25 20:22:32 -08:00
sysfs-common.c mm/damon/sysfs: make kobj_type structures constant 2023-02-09 16:51:45 -08:00
sysfs-common.h mm/damon/sysfs-schemes: expose per-region filter-passed bytes 2025-01-25 20:22:28 -08:00
sysfs-schemes.c mm/damon/sysfs-schemes: add a file for setting damos_filter->allow 2025-01-25 20:22:32 -08:00
sysfs.c mm/damon/sysfs-schemes: expose per-region filter-passed bytes 2025-01-25 20:22:28 -08:00
vaddr.c mm/damon: ask apply_scheme() to report filter-passed region-internal bytes 2025-01-25 20:22:26 -08:00