From patchwork Mon May 16 15:31:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dietmar Eggemann X-Patchwork-Id: 67902 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp1599216qge; Mon, 16 May 2016 08:31:16 -0700 (PDT) X-Received: by 10.98.46.130 with SMTP id u124mr45226530pfu.134.1463412676580; Mon, 16 May 2016 08:31:16 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yb5si46599050pab.124.2016.05.16.08.31.16; Mon, 16 May 2016 08:31:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753945AbcEPPbO (ORCPT + 29 others); Mon, 16 May 2016 11:31:14 -0400 Received: from foss.arm.com ([217.140.101.70]:47120 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752704AbcEPPbN (ORCPT ); Mon, 16 May 2016 11:31:13 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CB2613A; Mon, 16 May 2016 08:31:28 -0700 (PDT) Received: from [10.1.207.26] (e107985-lin.cambridge.arm.com [10.1.207.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 23FC33F246; Mon, 16 May 2016 08:31:11 -0700 (PDT) Subject: Re: [RFC][PATCH 4/7] sched: Replace sd_busy/nr_busy_cpus with sched_domain_shared To: Peter Zijlstra , mingo@kernel.org, linux-kernel@vger.kernel.org References: <20160509104807.284575300@infradead.org> <20160509105210.642395937@infradead.org> Cc: clm@fb.com, matt@codeblueprint.co.uk, mgalbraith@suse.de, tglx@linutronix.de, fweisbec@gmail.com From: Dietmar Eggemann Message-ID: <5739E7BC.70205@arm.com> Date: Mon, 16 May 2016 16:31:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20160509105210.642395937@infradead.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/05/16 11:48, Peter Zijlstra wrote: Couldn't you just always access sd->shared via sd = rcu_dereference(per_cpu(sd_llc, cpu)) for updating nr_busy_cpus? The call_rcu() thing is on the sd any way. @@ -5879,7 +5879,6 @@ static void destroy_sched_domains(struct sched_domain *sd) DEFINE_PER_CPU(struct sched_domain *, sd_llc); DEFINE_PER_CPU(int, sd_llc_size); DEFINE_PER_CPU(int, sd_llc_id); -DEFINE_PER_CPU(struct sched_domain_shared *, sd_llc_shared); DEFINE_PER_CPU(struct sched_domain *, sd_numa); DEFINE_PER_CPU(struct sched_domain *, sd_asym); @@ -5900,7 +5899,6 @@ static void update_top_cache_domain(int cpu) rcu_assign_pointer(per_cpu(sd_llc, cpu), sd); per_cpu(sd_llc_size, cpu) = size; per_cpu(sd_llc_id, cpu) = id; - rcu_assign_pointer(per_cpu(sd_llc_shared, cpu), sds); sd = lowest_flag_domain(cpu, SD_NUMA); rcu_assign_pointer(per_cpu(sd_numa, cpu), sd); diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0d8dad2972b6..5aed6089dae8 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8136,7 +8136,6 @@ static void nohz_idle_balance(struct rq *this_rq, enum cpu_idle_type idle) static inline bool nohz_kick_needed(struct rq *rq) { unsigned long now = jiffies; - struct sched_domain_shared *sds; struct sched_domain *sd; int nr_busy, cpu = rq->cpu; bool kick = false; @@ -8165,13 +8164,13 @@ static inline bool nohz_kick_needed(struct rq *rq) return true; rcu_read_lock(); - sds = rcu_dereference(per_cpu(sd_llc_shared, cpu)); - if (sds) { + sd = rcu_dereference(per_cpu(sd_llc, cpu)); + if (sd) { /* * XXX: write a coherent comment on why we do this. * See also: http:lkml.kernel.org/r/20111202010832.602203411@sbsiddha-desk.sc.intel.com */ - nr_busy = atomic_read(&sds->nr_busy_cpus); + nr_busy = atomic_read(&sd->shared->nr_busy_cpus); if (nr_busy > 1) { kick = true; goto unlock;