sched/fair: consider sched-idle CPU when selecting idle core
PATCH 1/1 sched/fair: consider sched-idle CPU when selecting idle core
From: Jiang Biao <[email protected]>
Sched-idle CPU has been considered in select_idle_cpu and select_idle_smt, it also needs to be considered in select_idle_core to be consistent and keep the same *idle* policy.
--- kernel/sched/fair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/fair.c +2 -2
@@ -6014,7 +6014,7 @@ void __update_idle_core(struct rq *rq)if (cpu == core)continue ; -if (!available_idle_cpu (cpu)) +if (!available_idle_cpu (cpu) && !sched_idle_cpu (cpu)) goto unlock; }
@@ -6045,7 +6045,7 @@ static int select_idle_core(struct task_struct *p, struct sched_domain *sd, intbool idle = true;for_each_cpu (cpu,cpu_smt_mask (core)) { -if (!available_idle_cpu (cpu)) { +if (!available_idle_cpu (cpu) && !sched_idle_cpu (cpu)) { idle = false;break ; }
Signature · 1 line
2.21.0
Vincent Guittot
maintainerQuoted 6 lines · Jiang Biao
From: Jiang Biao <[email protected]>
Sched-idle CPU has been considered in
select_idle_cpuandselect_idle_smt, it also needs to be considered inselect_idle_coreto be consistent and keep the same *idle* policy.
In the case of select_idle_core, we are looking for a core that is fully idle but if one CPU of the core is running a sched_idle task, the core will not be idle and we might end up having the wakeup task on a CPU and a sched_idle task on another CPU of the core which is not what we want
Quoted 32 lines
Signed-off-by Jiang Biao <[email protected]>--- kernel/sched/fair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)kernel/sched/fair.c +2
-3@@ -6014,7 +6014,7 @@ void __update_idle_core(struct rq *rq)if (cpu == core)continue ; -if (!available_idle_cpu (cpu)) +if (!available_idle_cpu (cpu) && !sched_idle_cpu (cpu)) goto unlock; }@@ -6045,7 +6045,7 @@ static int select_idle_core(struct task_struct *p, struct sched_domain *sd, intbool idle = true;for_each_cpu (cpu,cpu_smt_mask (core)) { -if (!available_idle_cpu (cpu)) { +if (!available_idle_cpu (cpu) && !sched_idle_cpu (cpu)) { idle = false;break ; } --2.21.0
Quoted 9 lines · Vincent Guittot
Quoted 6 lines · Jiang Biao
From: Jiang Biao <[email protected]>
Sched-idle CPU has been considered in
select_idle_cpuandselect_idle_smt, it also needs to be considered inselect_idle_coreto be consistent and keep the same *idle* policy.
Quoted 5 lines
In the case of
select_idle_core, we are looking for a core that is fully idle but if one CPU of the core is running asched_idletask, the core will not be idle and we might end up having the wakeup task on a CPU and asched_idletask on another CPU of the core which is not what we want
Got it. sched_idle task may interfere its sibling, which brings me another question,
If there's a core with smt1 running sched_idle task and smt2 idle, selecting smt1
rather than smt2 should be more helpful for wakee task, because wakee task could suppress the sched_idle task without neighbour interfering. And there seems to be no consideration about that currently. Is it worth improving that?
Thanks a lot.
Regards,
Jiang
Vincent Guittot
maintainerQuoted 17 lines · Jiang Biao
Quoted 9 lines · Vincent Guittot
Quoted 6 lines · Jiang Biao
From: Jiang Biao <[email protected]>
Sched-idle CPU has been considered in
select_idle_cpuandselect_idle_smt, it also needs to be considered inselect_idle_coreto be consistent and keep the same *idle* policy.Quoted 5 lines
In the case of
select_idle_core, we are looking for a core that is fully idle but if one CPU of the core is running asched_idletask, the core will not be idle and we might end up having the wakeup task on a CPU and asched_idletask on another CPU of the core which is not what we want
Quoted 6 lines
Got it.
sched_idletask may interfere its sibling, which brings me another question,
If there's a core with smt1 runningsched_idletask and smt2 idle, selecting smt1
rather than smt2 should be more helpful for wakee task, because wakee task could suppress thesched_idletask without neighbour interfering.
But the sched_idle will then probably quickly move on the idle smt2
Quoted 2 lines
And there seems to be no consideration about that currently. Is it worth improving that?
This will complexify and extend the duration of the search loop and as mentioned above, it will most probably be a nop at the end because of sched_idle task moving on smt2
Quoted 5 lines
Thanks a lot.
Regards,
Jiang
Quoted 26 lines · Vincent Guittot
Quoted 17 lines · Jiang Biao
Quoted 9 lines · Vincent Guittot
Quoted 6 lines · Jiang Biao
From: Jiang Biao <[email protected]>
Sched-idle CPU has been considered in
select_idle_cpuandselect_idle_smt, it also needs to be considered inselect_idle_coreto be consistent and keep the same *idle* policy.Quoted 5 lines
In the case of
select_idle_core, we are looking for a core that is fully idle but if one CPU of the core is running asched_idletask, the core will not be idle and we might end up having the wakeup task on a CPU and asched_idletask on another CPU of the core which is not what we wantQuoted 6 lines
Got it.
sched_idletask may interfere its sibling, which brings me another question,
If there's a core with smt1 runningsched_idletask and smt2 idle, selecting smt1
rather than smt2 should be more helpful for wakee task, because wakee task could suppress thesched_idletask without neighbour interfering.
Quoted 8 lines
But the
sched_idlewill then probably quickly move on the idle smt2Quoted 2 lines
And there seems to be no consideration about that currently. Is it worth improving that?
This will complexify and extend the duration of the search loop and as mentioned above, it will most probably be a nop at the end because of
sched_idletask moving on smt2
Indeed, the complexity is not worth.
Thanks for the explanation.
Regards,
Jiang
Quoted 6 lines
Quoted 6 lines
Thanks a lot.
Regards,
Jiang
Quoted 30 lines · Jiang Biao
Quoted 28 lines · Vincent Guittot
Quoted 17 lines · Jiang Biao
Quoted 9 lines · Vincent Guittot
Quoted 6 lines · Jiang Biao
From: Jiang Biao <[email protected]>
Sched-idle CPU has been considered in
select_idle_cpuandselect_idle_smt, it also needs to be considered inselect_idle_coreto be consistent and keep the same *idle* policy.Quoted 5 lines
In the case of
select_idle_core, we are looking for a core that is fully idle but if one CPU of the core is running asched_idletask, the core will not be idle and we might end up having the wakeup task on a CPU and asched_idletask on another CPU of the core which is not what we wantQuoted 6 lines
Got it.
sched_idletask may interfere its sibling, which brings me another question,
If there's a core with smt1 runningsched_idletask and smt2 idle, selecting smt1
rather than smt2 should be more helpful for wakee task, because wakee task could suppress thesched_idletask without neighbour interfering.But the
sched_idlewill then probably quickly move on the idle smt2
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
And there seems to be no consideration about that currently. Is it worth improving that?
This will complexify and extend the duration of the search loop and as mentioned above, it will most probably be a nop at the end because of
sched_idletask moving on smt2Indeed, the complexity is not worth.
Thanks for the explanation.
BTW., if you disagree then you could add a bit of debug instrumentation to measure to what extent it's a nop at the end of the search loop, to turn the "most probably" statement into a specific number.
Thanks,
Ingo
Quoted 43 lines · Ingo Molnar
Quoted 30 lines · Jiang Biao
Quoted 28 lines · Vincent Guittot
Quoted 17 lines · Jiang Biao
Quoted 9 lines · Vincent Guittot
Quoted 6 lines · Jiang Biao
From: Jiang Biao <[email protected]>
Sched-idle CPU has been considered in
select_idle_cpuandselect_idle_smt, it also needs to be considered inselect_idle_coreto be consistent and keep the same *idle* policy.Quoted 5 lines
In the case of
select_idle_core, we are looking for a core that is fully idle but if one CPU of the core is running asched_idletask, the core will not be idle and we might end up having the wakeup task on a CPU and asched_idletask on another CPU of the core which is not what we wantQuoted 6 lines
Got it.
sched_idletask may interfere its sibling, which brings me another question,
If there's a core with smt1 runningsched_idletask and smt2 idle, selecting smt1
rather than smt2 should be more helpful for wakee task, because wakee task could suppress thesched_idletask without neighbour interfering.But the
sched_idlewill then probably quickly move on the idle smt2Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
And there seems to be no consideration about that currently. Is it worth improving that?
This will complexify and extend the duration of the search loop and as mentioned above, it will most probably be a nop at the end because of
sched_idletask moving on smt2Indeed, the complexity is not worth.
Thanks for the explanation.
Quoted 8 lines
BTW., if you disagree then you could add a bit of debug instrumentation to measure to what extent it's a nop at the end of the search loop, to turn the "most probably" statement into a specific number.
Thanks,
Ingo
Ok, I'll try.
Thanks for your reply.
Regards,
Jiang