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.

samples/damon/wsse: use damon_initialized()

damon_sample_wsse 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-6-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
1f70367f c4a8e662

+9 -6
+9 -6
samples/damon/wsse.c
··· 102 102 } 103 103 } 104 104 105 - static bool init_called; 106 - 107 105 static int damon_sample_wsse_enable_store( 108 106 const char *val, const struct kernel_param *kp) 109 107 { ··· 115 117 if (enabled == is_enabled) 116 118 return 0; 117 119 118 - if (enabled) { 119 - if (!init_called) 120 - return 0; 120 + if (!damon_initialized()) 121 + return 0; 121 122 123 + if (enabled) { 122 124 err = damon_sample_wsse_start(); 123 125 if (err) 124 126 enabled = false; ··· 132 134 { 133 135 int err = 0; 134 136 135 - init_called = true; 137 + if (!damon_initialized()) { 138 + err = -ENOMEM; 139 + if (enabled) 140 + enabled = false; 141 + } 142 + 136 143 if (enabled) { 137 144 err = damon_sample_wsse_start(); 138 145 if (err)