Re: [PATCH] sched,fair: skip newidle_balance if a wakeup is pending

From: Valentin Schneider
Date: Mon Apr 19 2021 - 07:22:15 EST


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?

_nohz_idle_balance() "accidentally" already checks for that, but at the
head of the domain loop. What's the reason for doing it at the tail here?
It means we try at least one loop, but is there a point in that?

> }
> rcu_read_unlock();
> --
> 2.25.4