public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Wang <wangyun@linux.vnet.ibm.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: mingo@redhat.com, peterz@infradead.org,
	linaro-kernel@lists.linaro.org, patches@linaro.org,
	linux-kernel@vger.kernel.org, robin.randhawa@arm.com,
	Steve.Bannister@arm.com, Liviu.Dudau@arm.com,
	charles.garcia-tobin@arm.com, arvind.chauhan@arm.com
Subject: Re: [PATCH 1/2] sched: Optimize build_sched_domains() for saving first SD node for a cpu
Date: Wed, 05 Jun 2013 13:26:50 +0800	[thread overview]
Message-ID: <51AECC1A.9060400@linux.vnet.ibm.com> (raw)
In-Reply-To: <CAKohpokGrgFOtOT6Y3e4MOJBUQWT4FG4Mk-F6_M0V-pEEf3KYw@mail.gmail.com>

On 06/05/2013 01:07 PM, Viresh Kumar wrote:
> On 5 June 2013 10:12, Michael Wang <wangyun@linux.vnet.ibm.com> wrote:
>> Hi, Viresh
>>
>> On 06/04/2013 07:20 PM, Viresh Kumar wrote:
>> [snip]
>>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>>> index 58453b8..638f6cb 100644
>>> --- a/kernel/sched/core.c
>>> +++ b/kernel/sched/core.c
>>> @@ -6533,16 +6533,13 @@ static int build_sched_domains(const struct cpumask *cpu_map,
>>>               sd = NULL;
>>>               for (tl = sched_domain_topology; tl->init; tl++) {
>>>                       sd = build_sched_domain(tl, &d, cpu_map, attr, sd, i);
>>> +                     if (!*per_cpu_ptr(d.sd, i))
>>
>> What about:
>>                         if (tl == sched_domain_topology)
>>
>> It cost less than per_cpu_ptr(), isn't it?
> 
> How can I miss it.. Obviously its better :)
> 
> See if below one looks better (Attached too in case gmail screws up
> my mail)..

Looks good to me :)

Regards,
Michael Wang

> 
> --------x-------------x------------------
> 
> From: Viresh Kumar <viresh.kumar@linaro.org>
> Date: Tue, 4 Jun 2013 15:41:15 +0530
> Subject: [PATCH] sched: Optimize build_sched_domains() for saving first SD
>  node for a cpu
> 
> We are saving first scheduling domain for a cpu in build_sched_domains() by
> iterating over the nested sd->child list. We don't actually need to do it this
> way.
> 
> tl will be equal to sched_domain_topology for the first iteration and so we can
> set *per_cpu_ptr(d.sd, i) based on that.  So, save pointer to first SD while
> running the iteration loop over tl's.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  kernel/sched/core.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 58453b8..08a27be 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -6533,16 +6533,13 @@ static int build_sched_domains(const struct
> cpumask *cpu_map,
>  		sd = NULL;
>  		for (tl = sched_domain_topology; tl->init; tl++) {
>  			sd = build_sched_domain(tl, &d, cpu_map, attr, sd, i);
> +			if (tl == sched_domain_topology)
> +				*per_cpu_ptr(d.sd, i) = sd;
>  			if (tl->flags & SDTL_OVERLAP || sched_feat(FORCE_SD_OVERLAP))
>  				sd->flags |= SD_OVERLAP;
>  			if (cpumask_equal(cpu_map, sched_domain_span(sd)))
>  				break;
>  		}
> -
> -		while (sd->child)
> -			sd = sd->child;
> -
> -		*per_cpu_ptr(d.sd, i) = sd;
>  	}
> 
>  	/* Build the groups for the domains */
> 


  reply	other threads:[~2013-06-05  5:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-04 11:20 [PATCH 1/2] sched: Optimize build_sched_domains() for saving first SD node for a cpu Viresh Kumar
2013-06-04 11:20 ` [PATCH 2/2] sched: Remove unused params of build_sched_domain() Viresh Kumar
2013-06-05  4:42 ` [PATCH 1/2] sched: Optimize build_sched_domains() for saving first SD node for a cpu Michael Wang
2013-06-05  5:07   ` Viresh Kumar
2013-06-05  5:26     ` Michael Wang [this message]
2013-06-05 11:04     ` Peter Zijlstra
2013-06-05 12:42       ` Viresh Kumar
2013-06-05 13:03         ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51AECC1A.9060400@linux.vnet.ibm.com \
    --to=wangyun@linux.vnet.ibm.com \
    --cc=Liviu.Dudau@arm.com \
    --cc=Steve.Bannister@arm.com \
    --cc=arvind.chauhan@arm.com \
    --cc=charles.garcia-tobin@arm.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=patches@linaro.org \
    --cc=peterz@infradead.org \
    --cc=robin.randhawa@arm.com \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox