Re: [PATCH] sched/deadline: Reduce rq lock contention in dl_add_task_root_domain()

From: Valentin Schneider
Date: Tue Jan 19 2021 - 15:57:01 EST

On 19/01/21 09:35, Dietmar Eggemann wrote:
> dl_add_task_root_domain() is called during sched domain rebuild:
> rebuild_sched_domains_locked()
> partition_and_rebuild_sched_domains()
> rebuild_root_domains()
> for all top_cpuset descendants:
> update_tasks_root_domain()
> for all tasks of cpuset:
> dl_add_task_root_domain()
> Change it so that only the task pi lock is taken to check if the task
> has a SCHED_DEADLINE (DL) policy. In case that p is a DL task take the
> rq lock as well to be able to safely de-reference root domain's DL
> bandwidth structure.

A task's policy is stable under ->pi_lock, so LGTM.

Reviewed-by: Valentin Schneider <valentin.schneider@xxxxxxx>

> Most of the tasks will have another policy (namely SCHED_NORMAL) and
> can now bail without taking the rq lock.
> One thing to note here: Even in case that there aren't any DL user
> tasks, a slow frequency switching system with cpufreq gov schedutil has
> a DL task (sugov) per frequency domain running which participates in DL
> bandwidth management.
> Reviewed-by: Quentin Perret <qperret@xxxxxxxxxx>
> Signed-off-by: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>