Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/damon/reclaim: use damon_initialized()

DAMON_RECLAIM is assuming DAMON is ready to use in module_init time, and
uses its own hack to see if it is the time. Use damon_initialized(),
which is a way for seeing if DAMON is ready to be used that is more
reliable and better to maintain instead of the hack.

Link: https://lkml.kernel.org/r/20250916033511.116366-4-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

SeongJae Park and committed by
Andrew Morton
3f7a914a b663f17b

+7 -2
+7 -2
mm/damon/reclaim.c
··· 349 349 return 0; 350 350 351 351 /* Called before init function. The function will handle this. */ 352 - if (!ctx) 352 + if (!damon_initialized()) 353 353 goto set_param_out; 354 354 355 355 err = damon_reclaim_turn(enable); ··· 372 372 373 373 static int __init damon_reclaim_init(void) 374 374 { 375 - int err = damon_modules_new_paddr_ctx_target(&ctx, &target); 375 + int err; 376 376 377 + if (!damon_initialized()) { 378 + err = -ENOMEM; 379 + goto out; 380 + } 381 + err = damon_modules_new_paddr_ctx_target(&ctx, &target); 377 382 if (err) 378 383 goto out; 379 384