diff mbox

[RFC] sched: select_idle_sibling macro optimize

Message ID 1389795808-32013-1-git-send-email-alex.shi@linaro.org
State New
Headers show

Commit Message

Alex Shi Jan. 15, 2014, 2:23 p.m. UTC
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(+)

Comments

Alex Shi Jan. 16, 2014, 1:13 p.m. UTC | #1
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)))
>
Alex Shi Jan. 17, 2014, 2:14 a.m. UTC | #2
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
> 
>
Alex Shi Jan. 17, 2014, 5:40 a.m. UTC | #3
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.
diff mbox

Patch

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)))