From patchwork Fri Jun 22 15:17:02 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: 9558 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 AA24F23E55 for ; Fri, 22 Jun 2012 15:26:27 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 7AF76A1830E for ; Fri, 22 Jun 2012 15:26:27 +0000 (UTC) Received: by mail-yx0-f180.google.com with SMTP id q6so1742751yen.11 for ; Fri, 22 Jun 2012 08:26:27 -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-ibm-iss-spamdetectors :x-ibm-iss-detailinfo:x-gm-message-state; bh=Kn0MElsIvspdUzUaAG1LiuAKFLiT3GhG2Iyx7UN6tz4=; b=fXUxTl1sgM1Sb3q4NdynDlT0SujLmigx4L76CPUYtsZXmzFSclF+9q9iyQfxBZKfs3 Tgv5ILGGy239odnf8e7U87v0WIQ46JWu2PwYIJQaZsPhKc404PC2maLCp0Ag+tEqdoqf fwLBkCIJ5GaNk9lwy1nLa9E2xtGOLC+1b83KOnd6mMJhdXQuHjy2raed+p53nS5x9M7v uR31JPo5g3Iy0sOIuwZQCfAaXeqPOKn1g/HMCzW0q3tQC/SuB1QkxotknKjp7IA9YUbY L7aNYj4JA9OO0WaAGj2XKIH71FC3qRnVSb15GEbkmFAIQeIRkXVs+CxFKTvR7SqTWjZ7 MpOg== Received: by 10.50.160.198 with SMTP id xm6mr2181313igb.0.1340378786987; Fri, 22 Jun 2012 08:26:26 -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.231.24.148 with SMTP id v20csp71879ibb; Fri, 22 Jun 2012 08:26:26 -0700 (PDT) Received: by 10.68.238.68 with SMTP id vi4mr10756895pbc.123.1340378786003; Fri, 22 Jun 2012 08:26:26 -0700 (PDT) Received: from e34.co.us.ibm.com (e34.co.us.ibm.com. [32.97.110.152]) by mx.google.com with ESMTPS id vh4si9972398pbc.353.2012.06.22.08.26.25 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 22 Jun 2012 08:26:25 -0700 (PDT) Received-SPF: pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.110.152 as permitted sender) client-ip=32.97.110.152; Authentication-Results: mx.google.com; spf=pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.110.152 as permitted sender) smtp.mail=paulmck@linux.vnet.ibm.com Received: from /spool/local by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 22 Jun 2012 09:26:24 -0600 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e34.co.us.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 22 Jun 2012 09:25:32 -0600 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id B462CC40017 for ; Fri, 22 Jun 2012 15:25:13 +0000 (WET) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q5MFOlZG149614 for ; Fri, 22 Jun 2012 09:24:51 -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 q5MFOdZT019851 for ; Fri, 22 Jun 2012 09:24:46 -0600 Received: from paulmck-ThinkPad-W500 ([9.47.24.152]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q5MFOaxu019668; Fri, 22 Jun 2012 09:24:37 -0600 Received: by paulmck-ThinkPad-W500 (Postfix, from userid 1000) id 7D6BFE71A6; Fri, 22 Jun 2012 08:17:22 -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 03/22] rcu: Size rcu_node tree from nr_cpu_ids rather than NR_CPUS Date: Fri, 22 Jun 2012 08:17:02 -0700 Message-Id: <1340378241-6458-3-git-send-email-paulmck@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.8 In-Reply-To: <1340378241-6458-1-git-send-email-paulmck@linux.vnet.ibm.com> References: <20120622151655.GA6249@linux.vnet.ibm.com> <1340378241-6458-1-git-send-email-paulmck@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12062215-1780-0000-0000-000006B6BCF4 X-IBM-ISS-SpamDetectors: X-IBM-ISS-DetailInfo: BY=3.00000282; HX=3.00000190; KW=3.00000007; PH=3.00000001; SC=3.00000003; SDB=6.00150292; UDB=6.00034140; UTC=2012-06-22 15:26:23 X-Gm-Message-State: ALoCoQlUi2lpOSfKoEyQYeZP+fqhqThBYIiSSR9JzoxDcgCedrkAhqLdW+eze8fScVrzYXrpVn9D From: "Paul E. McKenney" The rcu_node tree array is sized based on compile-time constants, including NR_CPUS. Although this approach has worked well in the past, the recent trend by many distros to define NR_CPUS=4096 results in excessive grace-period-initialization latencies. This commit therefore substitutes the run-time computed nr_cpu_ids for the compile-time NR_CPUS when building the tree. This can result in much of the compile-time-allocated rcu_node array being unused. If this is a major problem, you are in a specialized situation anyway, so you can manually adjust the NR_CPUS, RCU_FANOUT, and RCU_FANOUT_LEAF kernel config parameters. Signed-off-by: Paul E. McKenney --- kernel/rcutree.c | 2 +- kernel/rcutree_plugin.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/kernel/rcutree.c b/kernel/rcutree.c index 260c1a3..f06a655 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c @@ -2672,7 +2672,7 @@ static void __init rcu_init_geometry(void) { int i; int j; - int n = NR_CPUS; + int n = nr_cpu_ids; int rcu_capacity[MAX_RCU_LVLS + 1]; /* If the compile-time values are accurate, just leave. */ diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h index 61aab6f..67b3b97 100644 --- a/kernel/rcutree_plugin.h +++ b/kernel/rcutree_plugin.h @@ -72,6 +72,8 @@ static void __init rcu_bootup_announce_oddness(void) #endif if (rcu_fanout_leaf != CONFIG_RCU_FANOUT_LEAF) printk(KERN_INFO "\tExperimental boot-time adjustment of leaf fanout to %d.\n", rcu_fanout_leaf); + if (nr_cpu_ids != NR_CPUS) + printk(KERN_INFO "\tRCU restricting CPUs from NR_CPUS=%d to nr_cpu_ids=%d.\n", NR_CPUS, nr_cpu_ids); } #ifdef CONFIG_TREE_PREEMPT_RCU