All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] sched: select_idle_sibling macro optimize
@ 2014-01-15 14:23 Alex Shi
  2014-01-16 13:13 ` Alex Shi
  0 siblings, 1 reply; 7+ messages in thread
From: Alex Shi @ 2014-01-15 14:23 UTC (permalink / raw)
  To: mingo, peterz, morten.rasmussen, vincent.guittot, daniel.lezcano
  Cc: wangyun, linux-kernel, Alex Shi

If the sd domain just has one group, then we must be caught the
	i == target later, and then goes to deeper level domain.
So just skip this domain checking to save some instructions.

Signed-off-by: Alex Shi <alex.shi@linaro.org>
---
 kernel/sched/fair.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index c7395d9..3265fbc 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4196,6 +4196,11 @@ static int select_idle_sibling(struct task_struct *p, int target)
 	sd = rcu_dereference(per_cpu(sd_llc, target));
 	for_each_lower_domain(sd) {
 		sg = sd->groups;
+
+		/* skip single group domain */
+		if (sg == sg->next)
+			continue;
+
 		do {
 			if (!cpumask_intersects(sched_group_cpus(sg),
 						tsk_cpus_allowed(p)))
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH] sched: select_idle_sibling macro optimize
  2014-01-15 14:23 [RFC PATCH] sched: select_idle_sibling macro optimize Alex Shi
@ 2014-01-16 13:13 ` Alex Shi
  2014-01-16 13:52   ` Mike Galbraith
  0 siblings, 1 reply; 7+ messages in thread
From: Alex Shi @ 2014-01-16 13:13 UTC (permalink / raw)
  To: mingo, peterz, morten.rasmussen, vincent.guittot, daniel.lezcano
  Cc: wangyun, linux-kernel, Alex Shi, Mike Galbraith

Add Mike Galbraith.

Any one like to give some comments?

On 01/15/2014 10:23 PM, Alex Shi wrote:
> If the sd domain just has one group, then we must be caught the
> 	i == target later, and then goes to deeper level domain.
> So just skip this domain checking to save some instructions.
> 
> Signed-off-by: Alex Shi <alex.shi@linaro.org>
> ---
>  kernel/sched/fair.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index c7395d9..3265fbc 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -4196,6 +4196,11 @@ static int select_idle_sibling(struct task_struct *p, int target)
>  	sd = rcu_dereference(per_cpu(sd_llc, target));
>  	for_each_lower_domain(sd) {
>  		sg = sd->groups;
> +
> +		/* skip single group domain */
> +		if (sg == sg->next)
> +			continue;
> +
>  		do {
>  			if (!cpumask_intersects(sched_group_cpus(sg),
>  						tsk_cpus_allowed(p)))
> 


-- 
Thanks
    Alex

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH] sched: select_idle_sibling macro optimize
  2014-01-16 13:13 ` Alex Shi
@ 2014-01-16 13:52   ` Mike Galbraith
  2014-01-17  2:14     ` Alex Shi
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Galbraith @ 2014-01-16 13:52 UTC (permalink / raw)
  To: Alex Shi
  Cc: mingo, peterz, morten.rasmussen, vincent.guittot, daniel.lezcano,
	wangyun, linux-kernel

On Thu, 2014-01-16 at 21:13 +0800, Alex Shi wrote: 
> Add Mike Galbraith.
> 
> Any one like to give some comments?
> 
> On 01/15/2014 10:23 PM, Alex Shi wrote:
> > If the sd domain just has one group, then we must be caught the
> > 	i == target later, and then goes to deeper level domain.
> > So just skip this domain checking to save some instructions.
> > 
> > Signed-off-by: Alex Shi <alex.shi@linaro.org>
> > ---
> >  kernel/sched/fair.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index c7395d9..3265fbc 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -4196,6 +4196,11 @@ static int select_idle_sibling(struct task_struct *p, int target)
> >  	sd = rcu_dereference(per_cpu(sd_llc, target));
> >  	for_each_lower_domain(sd) {
> >  		sg = sd->groups;
> > +
> > +		/* skip single group domain */
> > +		if (sg == sg->next)
> > +			continue;

When is that gonna happen?

-Mike



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH] sched: select_idle_sibling macro optimize
  2014-01-16 13:52   ` Mike Galbraith
@ 2014-01-17  2:14     ` Alex Shi
  2014-01-17  3:15       ` Michael wang
  2014-01-17  3:36       ` Mike Galbraith
  0 siblings, 2 replies; 7+ messages in thread
From: Alex Shi @ 2014-01-17  2:14 UTC (permalink / raw)
  To: Mike Galbraith
  Cc: mingo, peterz, morten.rasmussen, vincent.guittot, daniel.lezcano,
	wangyun, linux-kernel

On 01/16/2014 09:52 PM, Mike Galbraith wrote:
> On Thu, 2014-01-16 at 21:13 +0800, Alex Shi wrote: 
>> Add Mike Galbraith.
>>
>> Any one like to give some comments?
>>
>> On 01/15/2014 10:23 PM, Alex Shi wrote:
>>> If the sd domain just has one group, then we must be caught the
>>> 	i == target later, and then goes to deeper level domain.
>>> So just skip this domain checking to save some instructions.
>>>
>>> Signed-off-by: Alex Shi <alex.shi@linaro.org>
>>> ---
>>>  kernel/sched/fair.c | 5 +++++
>>>  1 file changed, 5 insertions(+)
>>>
>>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>>> index c7395d9..3265fbc 100644
>>> --- a/kernel/sched/fair.c
>>> +++ b/kernel/sched/fair.c
>>> @@ -4196,6 +4196,11 @@ static int select_idle_sibling(struct task_struct *p, int target)
>>>  	sd = rcu_dereference(per_cpu(sd_llc, target));
>>>  	for_each_lower_domain(sd) {
>>>  		sg = sd->groups;
>>> +
>>> +		/* skip single group domain */
>>> +		if (sg == sg->next)
>>> +			continue;
> 
> When is that gonna happen?

I had seen this in a Intel platform, you may have both CPU domain and MC
domain layer, because the domain flag is different, then they can not be
merged. and then the CPU domain just has one group.
> 
> -Mike
> 
> 


-- 
Thanks
    Alex

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH] sched: select_idle_sibling macro optimize
  2014-01-17  2:14     ` Alex Shi
@ 2014-01-17  3:15       ` Michael wang
  2014-01-17  3:36       ` Mike Galbraith
  1 sibling, 0 replies; 7+ messages in thread
From: Michael wang @ 2014-01-17  3:15 UTC (permalink / raw)
  To: Alex Shi, Mike Galbraith
  Cc: mingo, peterz, morten.rasmussen, vincent.guittot, daniel.lezcano,
	linux-kernel

On 01/17/2014 10:14 AM, Alex Shi wrote:
[snip]
>>
>> When is that gonna happen?
> 
> I had seen this in a Intel platform, you may have both CPU domain and MC
> domain layer, because the domain flag is different, then they can not be
> merged. and then the CPU domain just has one group.

CPU and MC are different domains, isn't it?

General should like:

CPU	cpu0				cpu1
MC	core0		core1		core0		core1
SMT	cpu 0	cpu 1	cpu 2	cpu 3	cpu 4	cpu 5	cpu 6	cpu 7

So for cpu0:

CPU	sg0:cpu0,1,2,3	sg1:cpu4,5,6,7
MC	sg0:cpu0,1	sg1:cpu2,3
SMT	sg0:cpu0	sg1:cpu1

If one domain only have one group, that's sounds really a weird topology...

Regards,
Michael Wang

>>
>> -Mike
>>
>>
> 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH] sched: select_idle_sibling macro optimize
  2014-01-17  2:14     ` Alex Shi
  2014-01-17  3:15       ` Michael wang
@ 2014-01-17  3:36       ` Mike Galbraith
  2014-01-17  5:40         ` Alex Shi
  1 sibling, 1 reply; 7+ messages in thread
From: Mike Galbraith @ 2014-01-17  3:36 UTC (permalink / raw)
  To: Alex Shi
  Cc: mingo, peterz, morten.rasmussen, vincent.guittot, daniel.lezcano,
	wangyun, linux-kernel

On Fri, 2014-01-17 at 10:14 +0800, Alex Shi wrote: 
> On 01/16/2014 09:52 PM, Mike Galbraith wrote:
> > On Thu, 2014-01-16 at 21:13 +0800, Alex Shi wrote: 
> >> Add Mike Galbraith.
> >>
> >> Any one like to give some comments?
> >>
> >> On 01/15/2014 10:23 PM, Alex Shi wrote:
> >>> If the sd domain just has one group, then we must be caught the
> >>> 	i == target later, and then goes to deeper level domain.
> >>> So just skip this domain checking to save some instructions.
> >>>
> >>> Signed-off-by: Alex Shi <alex.shi@linaro.org>
> >>> ---
> >>>  kernel/sched/fair.c | 5 +++++
> >>>  1 file changed, 5 insertions(+)
> >>>
> >>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> >>> index c7395d9..3265fbc 100644
> >>> --- a/kernel/sched/fair.c
> >>> +++ b/kernel/sched/fair.c
> >>> @@ -4196,6 +4196,11 @@ static int select_idle_sibling(struct task_struct *p, int target)
> >>>  	sd = rcu_dereference(per_cpu(sd_llc, target));
> >>>  	for_each_lower_domain(sd) {
> >>>  		sg = sd->groups;
> >>> +
> >>> +		/* skip single group domain */
> >>> +		if (sg == sg->next)
> >>> +			continue;
> > 
> > When is that gonna happen?
> 
> I had seen this in a Intel platform, you may have both CPU domain and MC
> domain layer, because the domain flag is different, then they can not be
> merged. and then the CPU domain just has one group.

But sd starts at MC.

-Mike


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH] sched: select_idle_sibling macro optimize
  2014-01-17  3:36       ` Mike Galbraith
@ 2014-01-17  5:40         ` Alex Shi
  0 siblings, 0 replies; 7+ messages in thread
From: Alex Shi @ 2014-01-17  5:40 UTC (permalink / raw)
  To: Mike Galbraith
  Cc: mingo, peterz, morten.rasmussen, vincent.guittot, daniel.lezcano,
	wangyun, linux-kernel

On 01/17/2014 11:36 AM, Mike Galbraith wrote:
>>>>> +
>>>>> > >>> +		/* skip single group domain */
>>>>> > >>> +		if (sg == sg->next)
>>>>> > >>> +			continue;
>>> > > 
>>> > > When is that gonna happen?
>> > 
>> > I had seen this in a Intel platform, you may have both CPU domain and MC
>> > domain layer, because the domain flag is different, then they can not be
>> > merged. and then the CPU domain just has one group.
> But sd starts at MC.

That's true. Sorry for noise.

-- 
Thanks
    Alex

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-01-17  5:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-15 14:23 [RFC PATCH] sched: select_idle_sibling macro optimize Alex Shi
2014-01-16 13:13 ` Alex Shi
2014-01-16 13:52   ` Mike Galbraith
2014-01-17  2:14     ` Alex Shi
2014-01-17  3:15       ` Michael wang
2014-01-17  3:36       ` Mike Galbraith
2014-01-17  5:40         ` Alex Shi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.