Skip to content

Commit 711b42e

Browse files
authored
Merge pull request raspberrypi#23 from sched-ext/atropos-updates
SCX: test_and_clear_cpu_idle() should always clear SMT mask
2 parents 9f00502 + 9adb3cd commit 711b42e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

kernel/sched/ext.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,9 +1925,11 @@ void __scx_notify_pick_next_task(struct rq *rq, struct task_struct *task,
19251925

19261926
static bool test_and_clear_cpu_idle(int cpu)
19271927
{
1928-
if (!cpumask_test_and_clear_cpu(cpu, idle_masks.cpu))
1929-
return false;
1930-
1928+
/*
1929+
* SMT mask should be cleared whether we can claim @cpu or not. The SMT
1930+
* cluster is not wholly idle either way. This also prevents
1931+
* scx_pick_idle_cpu() from getting caught in an infinite loop.
1932+
*/
19311933
if (sched_smt_active()) {
19321934
const struct cpumask *sbm = topology_sibling_cpumask(cpu);
19331935

@@ -1943,7 +1945,7 @@ static bool test_and_clear_cpu_idle(int cpu)
19431945
__cpumask_clear_cpu(cpu, idle_masks.smt);
19441946
}
19451947

1946-
return true;
1948+
return cpumask_test_and_clear_cpu(cpu, idle_masks.cpu);
19471949
}
19481950

19491951
static s32 scx_pick_idle_cpu(const struct cpumask *cpus_allowed, u64 flags)

0 commit comments

Comments
 (0)