diff options
Diffstat (limited to 'mm/damon')
| -rw-r--r-- | mm/damon/stat.c | 7 | ||||
| -rw-r--r-- | mm/damon/sysfs.c | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/mm/damon/stat.c b/mm/damon/stat.c index a8d6a30498300..3a55f6e41dc4c 100644 --- a/mm/damon/stat.c +++ b/mm/damon/stat.c @@ -237,6 +237,12 @@ static int damon_stat_start(void) { int err; + if (damon_stat_context) { + if (damon_is_running(damon_stat_context)) + return -EAGAIN; + damon_destroy_ctx(damon_stat_context); + } + damon_stat_context = damon_stat_build_ctx(); if (!damon_stat_context) return -ENOMEM; @@ -253,6 +259,7 @@ static void damon_stat_stop(void) { damon_stop(&damon_stat_context, 1); damon_destroy_ctx(damon_stat_context); + damon_stat_context = NULL; } static int damon_stat_enabled_store( diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index 4c0c8fdf450f2..a6c3e83a3dad5 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -1623,7 +1623,8 @@ static int damon_sysfs_turn_damon_on(struct damon_sysfs_kdamond *kdamond) repeat_call_control->data = kdamond; repeat_call_control->repeat = true; repeat_call_control->dealloc_on_cancel = true; - damon_call(ctx, repeat_call_control); + if (damon_call(ctx, repeat_call_control)) + kfree(repeat_call_control); return err; } |
