summaryrefslogtreecommitdiff
path: root/mm/damon
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-04-18 10:45:02 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-04-18 10:45:02 +0200
commit6e93ccc29258103e1fc652464b4ff75bc022da73 (patch)
tree85f741fa600ee0745b818a8c9cfdfc9b5b824c86 /mm/damon
parent327d73d5ef3ac25ffb58648c2c588c897b7efc41 (diff)
parent47a33eea6d5145d53e42315381ef28286c2218fb (diff)
Merge v6.18.23linux-rolling-lts
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm/damon')
-rw-r--r--mm/damon/stat.c7
-rw-r--r--mm/damon/sysfs.c3
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;
}