* [PATCH mm-unstable] mm/damon/stat: reset enabled when DAMON start failed
@ 2025-07-06 18:47 SeongJae Park
0 siblings, 0 replies; only message in thread
From: SeongJae Park @ 2025-07-06 18:47 UTC (permalink / raw)
To: Andrew Morton; +Cc: SeongJae Park, damon, kernel-team, linux-kernel, linux-mm
When damon_stat_start() fails, 'enabled' parameter is not reset. As a
result, users show the parameter 'Y' while it is not really working.
Fix it by resetting 'enabled' to 'false' when damon_stat_start() failed.
Fixes: 00e74895aba3 ("mm/damon: introduce DAMON_STAT module") # mm-unstable
Signed-off-by: SeongJae Park <sj@kernel.org>
---
mm/damon/stat.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/mm/damon/stat.c b/mm/damon/stat.c
index c35bd1852f0b..b75af871627e 100644
--- a/mm/damon/stat.c
+++ b/mm/damon/stat.c
@@ -225,8 +225,12 @@ static int damon_stat_enabled_store(
*/
return 0;
- if (enabled)
- return damon_stat_start();
+ if (enabled) {
+ err = damon_stat_start();
+ if (err)
+ enabled = false;
+ return err;
+ }
damon_stat_stop();
return 0;
}
@@ -240,6 +244,9 @@ static int __init damon_stat_init(void)
/* probably set via command line */
if (enabled)
err = damon_stat_start();
+
+ if (err && enabled)
+ enabled = false;
return err;
}
base-commit: 93a51997eb1dda993197a9f82602b96d56056ce4
--
2.39.5
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-07-06 18:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-06 18:47 [PATCH mm-unstable] mm/damon/stat: reset enabled when DAMON start failed SeongJae Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox