Skip to content

Commit 02f034d

Browse files
arighihtejun
authored andcommitted
sched_ext: idle: clarify comments
Add a comments to clarify about the usage of cpumask_intersects(). Moreover, update scx_select_cpu_dfl() description clarifying that the final step of the idle selection logic involves searching for any idle CPU in the system that the task can use. Reviewed-by: Yury Norov <yury.norov@gmail.com> Signed-off-by: Andrea Righi <arighi@nvidia.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 9cf9ace commit 02f034d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

kernel/sched/ext.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3180,6 +3180,10 @@ static bool test_and_clear_cpu_idle(int cpu)
31803180
* scx_pick_idle_cpu() can get caught in an infinite loop as
31813181
* @cpu is never cleared from idle_masks.smt. Ensure that @cpu
31823182
* is eventually cleared.
3183+
*
3184+
* NOTE: Use cpumask_intersects() and cpumask_test_cpu() to
3185+
* reduce memory writes, which may help alleviate cache
3186+
* coherence pressure.
31833187
*/
31843188
if (cpumask_intersects(smt, idle_masks.smt))
31853189
cpumask_andnot(idle_masks.smt, idle_masks.smt, smt);
@@ -3408,6 +3412,8 @@ static void update_selcpu_topology(void)
34083412
* 4. Pick a CPU within the same NUMA node, if enabled:
34093413
* - choose a CPU from the same NUMA node to reduce memory access latency.
34103414
*
3415+
* 5. Pick any idle CPU usable by the task.
3416+
*
34113417
* Step 3 and 4 are performed only if the system has, respectively, multiple
34123418
* LLC domains / multiple NUMA nodes (see scx_selcpu_topo_llc and
34133419
* scx_selcpu_topo_numa).

0 commit comments

Comments
 (0)