mm/damon/core: initialize damos->walk_completed in damon_new_scheme()
Subsystems (3)
SeongJae Park
maintainerPATCH 1/1 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.
--- mm/damon/core.c | 1 + 1 file changed, 1 insertion(+)
mm/damon/core.c +1 -0
@@ -373,6 +373,7 @@ struct damos *damon_new_scheme(struct damos_access_pattern *pattern,* or damon_attrs are updated. */ scheme->next_apply_sis =0 ; + scheme->walk_completed = false;INIT_LIST_HEAD (&scheme->filters); scheme->stat = (struct damos_stat ){};INIT_LIST_HEAD (&scheme->list);
base-commit: 3880bbe477938a3b30ff7bf2ef316adf98876671
Signature · 1 line
2.39.5