Re: [PATCH v3 9/9] sched/topology: Define and use shortcut pointers for wakeup sd_flag scan
From: Valentin Schneider
Date: Thu Apr 16 2020 - 06:27:14 EST
On 16/04/20 08:46, Vincent Guittot wrote:
>> @@ -6657,7 +6646,19 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags)
>>
>> rcu_read_lock();
>>
>> - sd = highest_flag_domain(cpu, sd_flag);
>> + switch (wake_flags & (WF_TTWU | WF_FORK | WF_EXEC)) {
>> + case WF_TTWU:
>> + sd_flag = SD_BALANCE_WAKE;
>> + sd = rcu_dereference(per_cpu(sd_balance_wake, cpu));
>
> It's worth having a direct pointer for the fast path which we always
> try to keep short but the other paths are already slow and will not
> get any benefit of this per cpu pointer.
> We should keep the loop for the slow paths
>
Which fast/slow paths are you referring to here? want_affine vs
!want_affine? If so, do you then mean that we should do the switch case
only when !want_affine, and otherwise look for the domain via the
for_each_domain() loop?
>> + break;
>> + case WF_FORK:
>> + sd_flag = SD_BALANCE_FORK;
>> + sd = rcu_dereference(per_cpu(sd_balance_fork, cpu));
>> + break;
>> + default:
>> + sd_flag = SD_BALANCE_EXEC;
>> + sd = rcu_dereference(per_cpu(sd_balance_exec, cpu));
>> + }
>>
>> /*
>> * If !want_affine, we just look for the highest domain where