summaryrefslogtreecommitdiff
path: root/mm/damon/stat.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/damon/stat.c')
-rw-r--r--mm/damon/stat.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/mm/damon/stat.c b/mm/damon/stat.c
index 217bde3c53b9f..723bdd673c105 100644
--- a/mm/damon/stat.c
+++ b/mm/damon/stat.c
@@ -253,6 +253,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;
@@ -269,6 +275,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(