Hi Peter, On Mon, May 11, 2026 at 01:31:12PM +0200, Peter Zijlstra wrote: > With commit 50653216e4ff ("sched: Add support to pick functions to > take rf") removing the balance callback, the pick_task() callback is > in charge of newidle balancing. > > This means pick_task_fair() should do so too. This hasn't been a > problem in practise because pick_next_task_fair() is used. However, > since we'll be removing that one shortly, make sure pick_next_task() > is up to scratch. While testing Prateek's throttle series, I noticed a panic issue when coresched is enabled and bisected to this patch. I fed the panic log and this patch to an agent and its analysis looks correct to me(cpu56 and cpu57 are siblings in a VM): cpu57 (holds core-wide lock) pick_next_task() [core scheduling] for_each_cpu_wrap(i, smt_mask, 57): i=57: pick_task(rq_57) pick_task_fair(rq_57) -> picks task A rq_57->core_pick = task A // task_rq(A) == rq_57 i=56: pick_task(rq_56) pick_task_fair(rq_56) cfs_rq->nr_queued == 0 goto idle sched_balance_newidle(rq_56) raw_spin_rq_unlock(rq_56) // core-wide lock released newidle_balance() pulls task A: rq_57 -> rq_56 // task_rq(A) == rq_56 now raw_spin_rq_lock(rq_56) // core-wide lock re-acquired return > 0 goto again pick_task_fair(rq_56) -> picks task A rq_56->core_pick = task A // first loop done // rq_57->core_pick is still task A (set before lock release) // but task_rq(A) == rq_56 now next = rq_57->core_pick // = task A put_prev_set_next_task(rq_57, prev, task A) __set_next_task_fair(rq_57, task A) hrtick_start_fair(rq_57, task A) WARN_ON_ONCE(task_rq(task A) != rq_57) // task_rq(A) == rq_56 I applied below diff and the problem is gone: diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 5f48af700fd44..942a543af3e54 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9897,6 +9897,9 @@ static struct task_struct *pick_task_fair(struct rq *rq, struct rq_flags *rf) return p; idle: + if (sched_core_enabled(rq)) + return NULL; + new_tasks = sched_balance_newidle(rq, rf); if (new_tasks < 0) return RETRY_TASK; Full dmesg of the panic is attached for your reference.