Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933236Ab3GWPrq (ORCPT ); Tue, 23 Jul 2013 11:47:46 -0400 Received: from merlin.infradead.org ([205.233.59.134]:44449 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932138Ab3GWPro (ORCPT ); Tue, 23 Jul 2013 11:47:44 -0400 Date: Tue, 23 Jul 2013 17:47:36 +0200 From: Peter Zijlstra To: Rakib Mullick Cc: mingo@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH, RFC] sched: update_top_cache_domain only at the times of building sched domain. Message-ID: <20130723154736.GB27075@twins.programming.kicks-ass.net> References: <1374594257.5382.5.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1374594257.5382.5.camel@localhost.localdomain> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2518 Lines: 71 On Tue, Jul 23, 2013 at 09:44:17PM +0600, Rakib Mullick wrote: > Currently, update_top_cache_domain() is called whenever schedule domain is built or destroyed. But, the following > callpath shows that they're at the same callpath and can be avoided update_top_cache_domain() while destroying schedule > domain and update only at the times of building schedule domains. > > partition_sched_domains() > detach_destroy_domain() > cpu_attach_domain() > update_top_cache_domain() > build_sched_domains() > cpu_attach_domain() > update_top_cache_domain() > Does it really matter? > > Signed-off-by: Rakib Mullick > --- > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index b7c32cb..8c6fee4 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -5102,8 +5102,8 @@ static void update_top_cache_domain(int cpu) > * Attach the domain 'sd' to 'cpu' as its base domain. Callers must > * hold the hotplug lock. > */ > -static void > -cpu_attach_domain(struct sched_domain *sd, struct root_domain *rd, int cpu) > +static void cpu_attach_domain(struct sched_domain *sd, struct root_domain *rd, > + int cpu, bool update_cache_domain) > { > struct rq *rq = cpu_rq(cpu); > struct sched_domain *tmp; > @@ -5138,7 +5138,8 @@ cpu_attach_domain(struct sched_domain *sd, struct root_domain *rd, int cpu) > rcu_assign_pointer(rq->sd, sd); > destroy_sched_domains(tmp, cpu); > > - update_top_cache_domain(cpu); > + if (update_cache_domain) > + update_top_cache_domain(cpu); > } > > /* cpus with isolated domains */ > @@ -6021,7 +6022,7 @@ static int build_sched_domains(const struct cpumask *cpu_map, > rcu_read_lock(); > for_each_cpu(i, cpu_map) { > sd = *per_cpu_ptr(d.sd, i); > - cpu_attach_domain(sd, d.rd, i); > + cpu_attach_domain(sd, d.rd, i, 1); > } > rcu_read_unlock(); > > @@ -6109,7 +6110,7 @@ static void detach_destroy_domains(const struct cpumask *cpu_map) > > rcu_read_lock(); > for_each_cpu(i, cpu_map) > - cpu_attach_domain(NULL, &def_root_domain, i); > + cpu_attach_domain(NULL, &def_root_domain, i, 0); > rcu_read_unlock(); > } This just makes the code uglier for no gain afaict. If you really need to do this, key off @sd == NULL or something. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/