Re: [PATCH v2 4/7] sched/fair: Add SHARED_RUNQ sched feature and skeleton calls

From: Peter Zijlstra
Date: Tue Jul 11 2023 - 05:46:26 EST


On Mon, Jul 10, 2023 at 03:03:39PM -0500, David Vernet wrote:

> @@ -11843,6 +11871,9 @@ static int newidle_balance(struct rq *this_rq, struct rq_flags *rf)
> if (!cpu_active(this_cpu))
> return 0;
>
> + if (sched_feat(SHARED_RUNQ) && shared_runq_pick_next_task(this_rq, rf))
> + return -1;
> +

Next patch implements shared_runq_pick_next_task() with the same return
values as newidle_balance(), which would seem to suggest the following
instead:

if (sched_feat(SHARED_RUNQ)) {
pulled_task = shared_runq_pick_next_task(this_rq, rf);
if (pulled_task)
return pulled_task;
}

Additionally, I think we wants something like:

sd = rcu_dereference_check_sched_domain(this_rq->sd);
if (sched_feat(SHARED_RUNQ)) {
... /* see above */

sd = rcu_dereference(*this_cpu_ptr(&sd_llc));
sd = sd->parent;
}

to ensure we skip <=LLC domains, since those have already been covered
by this shiny new thing, no?