summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kernel/sched/ext.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index f1a185ab5fbc..0c68ace02e4b 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;
}