From patchwork Thu Sep 20 18:48:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 11596 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id A28D823E54 for ; Thu, 20 Sep 2012 18:48:57 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id E2AF3A1823C for ; Thu, 20 Sep 2012 18:48:56 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so3420474iej.11 for ; Thu, 20 Sep 2012 11:48:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-content-scanned:x-cbid:x-gm-message-state; bh=5/VohMEkadjC4vG72/Hie4QNAoX7fqhWdibxGvBbLZw=; b=Qg6K1ly6UjtZZ547+gUTOGeyqDWxJ5zONbIHhu0UDJNfoNM881pB9P0z3K0JNeAk52 RN3vXHBek+2vNYFxsVkHeBiyxK0qAM67KiGWk/MguAuWRjLtITDibmlNte0ma08mQ5V8 T8uCbJ3f3eoCaUA6P/qotypyddg9qbTy33ZODvFASLJXNMD6212abPztrUkiT7llbTvj P2g83Sf1ALfCavyTaOCmn7cMcd7tsXIUeyy001fgL2pbKlySzx2B//Qdp0OiMYFjAkI8 MMkoFlkkvnzO0/pX+Iu15W3AYVLADd5GMWVdy94TiCnnZi+1/jsKvbs5wTXYZZITVJI2 cN8A== Received: by 10.50.0.193 with SMTP id 1mr2647360igg.0.1348166936673; Thu, 20 Sep 2012 11:48:56 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp92219igc; Thu, 20 Sep 2012 11:48:56 -0700 (PDT) Received: by 10.50.236.6 with SMTP id uq6mr2568957igc.50.1348166936225; Thu, 20 Sep 2012 11:48:56 -0700 (PDT) Received: from e32.co.us.ibm.com (e32.co.us.ibm.com. [32.97.110.150]) by mx.google.com with ESMTPS id uq1si9785221igc.69.2012.09.20.11.48.55 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 20 Sep 2012 11:48:56 -0700 (PDT) Received-SPF: pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.110.150 as permitted sender) client-ip=32.97.110.150; Authentication-Results: mx.google.com; spf=pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.110.150 as permitted sender) smtp.mail=paulmck@linux.vnet.ibm.com Received: from /spool/local by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 20 Sep 2012 12:48:55 -0600 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 20 Sep 2012 12:48:52 -0600 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 65DE1C40008 for ; Thu, 20 Sep 2012 12:48:47 -0600 (MDT) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q8KImnXk080700 for ; Thu, 20 Sep 2012 12:48:50 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q8KImQge021268 for ; Thu, 20 Sep 2012 12:48:47 -0600 Received: from paulmck-ThinkPad-W500 ([9.47.24.72]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q8KImNC6020803; Thu, 20 Sep 2012 12:48:25 -0600 Received: by paulmck-ThinkPad-W500 (Postfix, from userid 1000) id 127A0EC4F4; Thu, 20 Sep 2012 11:48:23 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org Cc: mingo@elte.hu, laijs@cn.fujitsu.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@polymtl.ca, josh@joshtriplett.org, niv@us.ibm.com, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, Valdis.Kletnieks@vt.edu, dhowells@redhat.com, eric.dumazet@gmail.com, darren@dvhart.com, fweisbec@gmail.com, sbw@mit.edu, patches@linaro.org, "Paul E. McKenney" Subject: [PATCH tip/core/rcu 23/23] rcu: Shrink RCU based on number of CPUs Date: Thu, 20 Sep 2012 11:48:19 -0700 Message-Id: <1348166900-18716-23-git-send-email-paulmck@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.8 In-Reply-To: <1348166900-18716-1-git-send-email-paulmck@linux.vnet.ibm.com> References: <20120920184751.GA18657@linux.vnet.ibm.com> <1348166900-18716-1-git-send-email-paulmck@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12092018-5406-0000-0000-000000754FC7 X-Gm-Message-State: ALoCoQmVocGzev7FJQM0hwUwhy+Wmr6hhcLUxOrol9uLYQCiFNsAcV5AuaC/51R3I8WqsLpIpokT From: "Paul E. McKenney" Currently, rcu_init_geometry() only reshapes RCU's combining trees if the leaf fanout is changed at boot time. This means that by default, kernels compiled with (say) NR_CPUS=4096 will keep oversized data structures, even when running on systems with (say) four CPUs. This commit therefore checks to see if the maximum number of CPUs on the actual running system (nr_cpu_ids) differs from NR_CPUS, and if so reshapes the combining trees accordingly. Reported-by: Mike Galbraith Signed-off-by: Paul E. McKenney --- kernel/rcutree.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/kernel/rcutree.c b/kernel/rcutree.c index 5068e51..52b24c0 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c @@ -2819,7 +2819,8 @@ static void __init rcu_init_geometry(void) int rcu_capacity[MAX_RCU_LVLS + 1]; /* If the compile-time values are accurate, just leave. */ - if (rcu_fanout_leaf == CONFIG_RCU_FANOUT_LEAF) + if (rcu_fanout_leaf == CONFIG_RCU_FANOUT_LEAF && + nr_cpu_ids == NR_CPUS) return; /*