On Mon, 2021-04-19 at 12:22 +0100, Valentin Schneider wrote: > On 18/04/21 22:17, Rik van Riel wrote: > > @@ -10661,7 +10669,8 @@ static int newidle_balance(struct rq > > *this_rq, struct rq_flags *rf) > > * Stop searching for tasks to pull if there are > > * now runnable tasks on this rq. > > */ > > - if (pulled_task || this_rq->nr_running > 0) > > + if (pulled_task || this_rq->nr_running > 0 || > > + this_rq->ttwu_pending) > > break; > > I thought newidle_balance() would already handle this by checking > idle_cpu(), but that can't work due to rq->curr never being rq->idle > here > (we're trying very hard to prevent this!). > > Would there be any point in bunching up these two checks from > idle_cpu() > into an inline helper and reusing it here? I'm not sure, all the sched classes seem to have their own magic in the balance functions, and there are enough special situations out there that we might only be able to consolidate a few callsites, not the rest. Also, it turns out newidle_balance needs a different return value depending on whether we have ->ttwu_pending, a pulled task, or a queued realtime task... I'll send v2 without any considation here, since I cannot figure out a way to make things better here :) -- All Rights Reversed.