Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1405255 > unrolled thread

[PATCH 04/16] sched/fair: Optimize find_idlest_cpu() when there is no choice

Started byMorten Rasmussen <morten.rasmussen@arm.com>
First post2016-05-23 13:10 +0200
Last post2016-05-24 10:20 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 04/16] sched/fair: Optimize find_idlest_cpu() when there is no choice Morten Rasmussen <morten.rasmussen@arm.com> - 2016-05-23 13:10 +0200
    Re: [PATCH 04/16] sched/fair: Optimize find_idlest_cpu() when there  is no choice Mike Galbraith <umgwanakikbuti@gmail.com> - 2016-05-24 08:30 +0200
      Re: [PATCH 04/16] sched/fair: Optimize find_idlest_cpu() when there  is no choice Morten Rasmussen <morten.rasmussen@arm.com> - 2016-05-24 10:10 +0200
        Re: [PATCH 04/16] sched/fair: Optimize find_idlest_cpu() when there  is no choice Mike Galbraith <umgwanakikbuti@gmail.com> - 2016-05-24 10:20 +0200

#1405255 — [PATCH 04/16] sched/fair: Optimize find_idlest_cpu() when there is no choice

FromMorten Rasmussen <morten.rasmussen@arm.com>
Date2016-05-23 13:10 +0200
Subject[PATCH 04/16] sched/fair: Optimize find_idlest_cpu() when there is no choice
Message-ID<rBVUe-53H-23@gated-at.bofh.it>
In the current find_idlest_group()/find_idlest_cpu() search we end up
calling find_idlest_cpu() in a sched_group containing only one cpu in
the end. Checking idle-states becomes pointless when there is no
alternative, so bail out instead.

cc: Ingo Molnar <mingo@redhat.com>
cc: Peter Zijlstra <peterz@infradead.org>

Signed-off-by: Morten Rasmussen <morten.rasmussen@arm.com>
---
 kernel/sched/fair.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 0fe3020..564215d 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5155,6 +5155,11 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)
 	int shallowest_idle_cpu = -1;
 	int i;
 
+	/* Check if we have any choice */
+	if (group->group_weight == 1) {
+		return cpumask_first(sched_group_cpus(group));
+	}
+
 	/* Traverse only the allowed CPUs */
 	for_each_cpu_and(i, sched_group_cpus(group), tsk_cpus_allowed(p)) {
 		if (idle_cpu(i)) {
-- 
1.9.1

[toc] | [next] | [standalone]


#1405869 — Re: [PATCH 04/16] sched/fair: Optimize find_idlest_cpu() when there is no choice

FromMike Galbraith <umgwanakikbuti@gmail.com>
Date2016-05-24 08:30 +0200
SubjectRe: [PATCH 04/16] sched/fair: Optimize find_idlest_cpu() when there is no choice
Message-ID<rCe0N-89R-9@gated-at.bofh.it>
In reply to#1405255
On Mon, 2016-05-23 at 11:58 +0100, Morten Rasmussen wrote:
> In the current find_idlest_group()/find_idlest_cpu() search we end up
> calling find_idlest_cpu() in a sched_group containing only one cpu in
> the end. Checking idle-states becomes pointless when there is no
> alternative, so bail out instead.
> 
> cc: Ingo Molnar <mingo@redhat.com>
> cc: Peter Zijlstra <peterz@infradead.org>
> 
> Signed-off-by: Morten Rasmussen <morten.rasmussen@arm.com>
> ---
>  kernel/sched/fair.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 0fe3020..564215d 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -5155,6 +5155,11 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)
>  > 	> int shallowest_idle_cpu = -1;
>  > 	> int i;
>  
> +> 	> /* Check if we have any choice */
> +> 	> if (group->group_weight == 1) {
> +> 	> 	> return cpumask_first(sched_group_cpus(group));
> +> 	> }
> +

Hm, if task isn't allowed there, too bad?

>  	/* Traverse only the allowed CPUs */
>  > 	> for_each_cpu_and(i, sched_group_cpus(group), tsk_cpus_allowed(p)) {
>  > 	> 	> if (idle_cpu(i)) {

[toc] | [prev] | [next] | [standalone]


#1405925 — Re: [PATCH 04/16] sched/fair: Optimize find_idlest_cpu() when there is no choice

FromMorten Rasmussen <morten.rasmussen@arm.com>
Date2016-05-24 10:10 +0200
SubjectRe: [PATCH 04/16] sched/fair: Optimize find_idlest_cpu() when there is no choice
Message-ID<rCfzA-Ln-11@gated-at.bofh.it>
In reply to#1405869
On Tue, May 24, 2016 at 08:29:05AM +0200, Mike Galbraith wrote:
> On Mon, 2016-05-23 at 11:58 +0100, Morten Rasmussen wrote:
> > In the current find_idlest_group()/find_idlest_cpu() search we end up
> > calling find_idlest_cpu() in a sched_group containing only one cpu in
> > the end. Checking idle-states becomes pointless when there is no
> > alternative, so bail out instead.
> > 
> > cc: Ingo Molnar <mingo@redhat.com>
> > cc: Peter Zijlstra <peterz@infradead.org>
> > 
> > Signed-off-by: Morten Rasmussen <morten.rasmussen@arm.com>
> > ---
> >  kernel/sched/fair.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 0fe3020..564215d 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -5155,6 +5155,11 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)
> >  > 	> int shallowest_idle_cpu = -1;
> >  > 	> int i;
> >  
> > +> 	> /* Check if we have any choice */
> > +> 	> if (group->group_weight == 1) {
> > +> 	> 	> return cpumask_first(sched_group_cpus(group));
> > +> 	> }
> > +
> 
> Hm, if task isn't allowed there, too bad?

Is that possible for single-cpu groups? I thought we skipped groups with
no cpus allowed in find_idlest_group():

                /* Skip over this group if it has no CPUs allowed */
                if (!cpumask_intersects(sched_group_cpus(group),
                                        tsk_cpus_allowed(p)))
                        continue;

Since the group has at least one cpu allowed and only contains one cpu,
that cpu must be allowed. No?

[toc] | [prev] | [next] | [standalone]


#1405926 — Re: [PATCH 04/16] sched/fair: Optimize find_idlest_cpu() when there is no choice

FromMike Galbraith <umgwanakikbuti@gmail.com>
Date2016-05-24 10:20 +0200
SubjectRe: [PATCH 04/16] sched/fair: Optimize find_idlest_cpu() when there is no choice
Message-ID<rCfJf-OC-7@gated-at.bofh.it>
In reply to#1405925
On Tue, 2016-05-24 at 09:05 +0100, Morten Rasmussen wrote:
> On Tue, May 24, 2016 at 08:29:05AM +0200, Mike Galbraith wrote:
> >  
> > > +> > > > 	> > > > /* Check if we have any choice */
> > > +> > > > 	> > > > if (group->group_weight == 1) {
> > > +> > > > 	> > > > > > > 	> > > > return cpumask_first(sched_group_cpus(group));
> > > +> > > > 	> > > > }
> > > +
> > 
> > Hm, if task isn't allowed there, too bad?
> 
> Is that possible for single-cpu groups? I thought we skipped groups with
> no cpus allowed in find_idlest_group():
> 
>                 /* Skip over this group if it has no CPUs allowed */
>                 if (!cpumask_intersects(sched_group_cpus(group),
>                                         tsk_cpus_allowed(p)))
>                         continue;
> 
> Since the group has at least one cpu allowed and only contains one cpu,
> that cpu must be allowed. No?

Yup, you're right, handled before we got there.

	-Mike

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web