Skip to content

Commit 5693fa7

Browse files
Valentin SchneiderPeter Zijlstra
authored andcommitted
kcsan: Use preemption model accessors
Per PREEMPT_DYNAMIC, checking CONFIG_PREEMPT doesn't tell you the actual preemption model of the live kernel. Use the newly-introduced accessors instead. Signed-off-by: Valentin Schneider <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Marco Elver <[email protected]> Acked-by: Frederic Weisbecker <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent cfe43f4 commit 5693fa7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

kernel/kcsan/kcsan_test.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,13 +1380,14 @@ static const void *nthreads_gen_params(const void *prev, char *desc)
13801380
else
13811381
nthreads *= 2;
13821382

1383-
if (!IS_ENABLED(CONFIG_PREEMPT) || !IS_ENABLED(CONFIG_KCSAN_INTERRUPT_WATCHER)) {
1383+
if (!preempt_model_preemptible() ||
1384+
!IS_ENABLED(CONFIG_KCSAN_INTERRUPT_WATCHER)) {
13841385
/*
13851386
* Without any preemption, keep 2 CPUs free for other tasks, one
13861387
* of which is the main test case function checking for
13871388
* completion or failure.
13881389
*/
1389-
const long min_unused_cpus = IS_ENABLED(CONFIG_PREEMPT_NONE) ? 2 : 0;
1390+
const long min_unused_cpus = preempt_model_none() ? 2 : 0;
13901391
const long min_required_cpus = 2 + min_unused_cpus;
13911392

13921393
if (num_online_cpus() < min_required_cpus) {

0 commit comments

Comments
 (0)