scheduler: scan idle cpu in cluster for tasks within one LLC
Quoted 53 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
-----Original Message-----
From: Dietmar Eggemann [mailto:[email protected]][...]
Quoted 1 line
Quoted 1 line
Quoted 1 line · Barry Song
[...]
Quoted 6 lines
Quoted 2 lines
I am really confused. The whole code has only checked if
wake_flagshasWF_TTWU, it has never checked ifsd_domainhasSD_BALANCE_WAKEflag.look at :
#defineWF_TTWU0x08/* Wakeup; maps toSD_BALANCE_WAKE*/Quoted 25 lines
so when
wake_widereturn false, we use thewake_affinemecanism but if it's false then we fllback to default mode which looks for:
if (tmp->flags&sd_flag)This means looking for
SD_BALANCE_WAKEwhich is never setso sd will stay NULL and you will end up calling
select_idle_siblinganywayQuoted 17 lines
static int
select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags){ ... if (wake_flags & WF_TTWU) { record_wakee(p); if (sched_energy_enabled()) { new_cpu = find_energy_efficient_cpu(p, prev_cpu); if (new_cpu >= 0) return new_cpu; new_cpu = prev_cpu; } want_affine = !wake_wide(p) && cpumask_test_cpu(cpu,
p->cpus_ptr);Quoted 11 lines
Quoted 11 lines
} }And
try_to_wake_up()has always setWF_TTWU:
static inttry_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags){ cpu = select_task_rq(p, p->wake_cpu, wake_flags | WF_TTWU); ... }
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
So the change in
wake_widewill actually affect the value ofwant_affine. And I did also see code entered slow path during my benchmark.Yes, this is happening but IMHO not for wakeups. Check
wake_flagsfor the tasks which go throughslow pathon your machine. They should haveWF_EXECorWF_FORK, notWF_TTWU(&WF_SYNC).
Yes. Both of you are right. The slow path I reported yesterday came from WF_FORK actually.
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
One issue I mentioned during linaro open discussion is that since I have moved to use cluster size to decide the value of
wake_wide, relatively less tasks will makewake_wide()decide to go to slow path, thus, tasks begin to spread to other NUMA, but actuallyllc_sizemight be able to contain those tasks. So a possible model might be:
static intwake_wide(struct task_struct *p)
{
tasksize < cluster : scan cluster
tasksize > llc : slow path
tasksize > cluster && tasksize < llc: scan llc
}
Quoted 4 lines
Quoted 1 line
Quoted 1 line
thoughts?
Like Vincent explained, the return value of
wake_wide()doesn't matter. For wakeups you always end up insis().
Though we will never go to slow path, wake_wide() will affect want_affine, so eventually affect the "new_cpu"?
for_each_domain(cpu, tmp) {
/*
* If both 'cpu' and 'prev_cpu' are part of this domain,
* cpu is a valid SD_WAKE_AFFINE target.
*/
if (want_affine && (tmp->flags & SD_WAKE_AFFINE) &&
cpumask_test_cpu(prev_cpu, sched_domain_span(tmp))) {
if (cpu != prev_cpu)
new_cpu = wake_affine(tmp, p, cpu, prev_cpu, sync);
sd = NULL; /* Prefer wake_affine over balance flags */
break;
}
if (tmp->flags & sd_flag)
sd = tmp;
else if (!want_affine)
break;
}If wake_affine is false, the above won't execute, new_cpu(target) will always be "prev_cpu"? so when "task size > cluster size" in wake_wide(), this means we won't pull the wakee to the cluster of waker since target is always prev_cpu? It seems sensible.
Thanks
Barry