* [PATCH] mm/damon/sysfs: skip registration if DAMON core init fails
@ 2026-11-23 7:51 Aveline Noir
2026-11-23 8:06 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Aveline Noir @ 2026-11-23 7:51 UTC (permalink / raw)
To: SJ Park, Andrew Morton; +Cc: Lian Wang, Dawei Li, damon, linux-mm
Hi SJ,
Here's the sysfs fix I mentioned in the report queue review.
-- >8 --
While reviewing the DAMON report queue series, I noticed that DAMON
sysfs still registers its interface if DAMON core initialization fails.
If damon_init() fails to allocate damon_region_cache, starting a
kdamond with an initial region can pass a NULL cache to
kmem_cache_alloc() via damon_new_region().
Check damon_initialized() before creating the DAMON sysfs directory and
return -ENOMEM if the core is unavailable.
Fixes: a18709442869 ("mm/damon: improve damon_new_region strategy")
Signed-off-by: Aveline Noir <jm5905938@gmail.com>
---
Tests passed in x86-64 QEMU TCG guests on 9f004372ebeb.
---
mm/damon/sysfs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index 779c98205a94..7de0f03a3fd5 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -3035,6 +3035,9 @@ static int __init damon_sysfs_init(void)
struct damon_sysfs_ui_dir *admin;
int err;
+ if (!damon_initialized())
+ return -ENOMEM;
+
damon_sysfs_root = kobject_create_and_add("damon", mm_kobj);
if (!damon_sysfs_root)
return -ENOMEM;
---
base-commit: 9f004372ebeb18fdeb699f9880a0e472df90135b
change-id: 20261123-damon-sysfs-init-guard-fc87e688acae
--
Thanks,
Aveline Noir
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-23 8:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 7:51 [PATCH] mm/damon/sysfs: skip registration if DAMON core init fails Aveline Noir
2026-11-23 8:06 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox