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/lru_sort: use damon_initialized()

DAMON_LRU_SORT 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-5-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
c4a8e662 3f7a914a

+7 -2
+7 -2
mm/damon/lru_sort.c
··· 345 345 return 0; 346 346 347 347 /* Called before init function. The function will handle this. */ 348 - if (!ctx) 348 + if (!damon_initialized()) 349 349 goto set_param_out; 350 350 351 351 err = damon_lru_sort_turn(enable); ··· 368 368 369 369 static int __init damon_lru_sort_init(void) 370 370 { 371 - int err = damon_modules_new_paddr_ctx_target(&ctx, &target); 371 + int err; 372 372 373 + if (!damon_initialized()) { 374 + err = -ENOMEM; 375 + goto out; 376 + } 377 + err = damon_modules_new_paddr_ctx_target(&ctx, &target); 373 378 if (err) 374 379 goto out; 375 380