diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c index f1a185ab5fbc7e..0c68ace02e4b2e 100644 --- a/kernel/sched/ext.c +++ b/kernel/sched/ext.c @@ -3342,6 +3342,12 @@ static s32 scx_select_cpu_dfl(struct task_struct *p, s32 prev_cpu, *found = false; + + /* + * This is necessary to protect llc_cpus. + */ + rcu_read_lock(); + /* * Determine the scheduling domain only if the task is allowed to run * on all CPUs. @@ -3476,9 +3482,12 @@ static s32 scx_select_cpu_dfl(struct task_struct *p, s32 prev_cpu, if (cpu >= 0) goto cpu_found; + rcu_read_unlock(); return prev_cpu; cpu_found: + rcu_read_unlock(); + *found = true; return cpu; }