From patchwork Fri Jun 15 21:05:57 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: 9352 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 DAE6A23E0C for ; Fri, 15 Jun 2012 21:06:37 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id AB4A6A18513 for ; Fri, 15 Jun 2012 21:06:37 +0000 (UTC) Received: by mail-gg0-f180.google.com with SMTP id f1so2962892ggn.11 for ; Fri, 15 Jun 2012 14:06:37 -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=aeDcoD4KqyaETgEHMmXEiHEhjGIK4fG1b+CcfU9W6To=; b=F5U/BpHqRYVznWQ8li5VhJ4sCXCcToIr7LxQo6oZ6derYuVzTjrkNOzjFx9mhOmPNg JxtVJFc2EBQVfCAo59L4lhsc/19m782W1fqtWUYm39/0SP3e5c4s21eOzHgKSTp8wK0K ZnErhO4FVx65XQDZ3bSSC+T6NhScV2IB1GNBv0RAKiivqamv/6Gp6VvI5MA1HFxQWeve qW87ncaMzd0Tz5sQxOprUPZouXunQeyM9fnUH8xorQ6Ag5OHWcjRSUxsLXlfG7hlyiLC 49I8N2MWMfLOAtTU0T5F5l3j0qdu5NgW2kwbevZJcRhpICgXvPBXyrWR1iUL/WCnowSC rbeA== Received: by 10.50.57.167 with SMTP id j7mr3246901igq.53.1339794397385; Fri, 15 Jun 2012 14:06:37 -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 v20csp169701ibb; Fri, 15 Jun 2012 14:06:36 -0700 (PDT) Received: by 10.68.241.227 with SMTP id wl3mr24124146pbc.89.1339794396700; Fri, 15 Jun 2012 14:06:36 -0700 (PDT) Received: from e31.co.us.ibm.com (e31.co.us.ibm.com. [32.97.110.149]) by mx.google.com with ESMTPS id hc10si17900036pbc.241.2012.06.15.14.06.35 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 15 Jun 2012 14:06:36 -0700 (PDT) Received-SPF: pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.110.149 as permitted sender) client-ip=32.97.110.149; Authentication-Results: mx.google.com; spf=pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.110.149 as permitted sender) smtp.mail=paulmck@linux.vnet.ibm.com Received: from /spool/local by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 15 Jun 2012 15:06:35 -0600 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e31.co.us.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 15 Jun 2012 15:06:33 -0600 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 25C7719D8051 for ; Fri, 15 Jun 2012 21:06:27 +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 q5FL6G0R049952 for ; Fri, 15 Jun 2012 15:06:19 -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 q5FL6CdQ001954 for ; Fri, 15 Jun 2012 15:06:15 -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 q5FL6Ccd001943; Fri, 15 Jun 2012 15:06:12 -0600 Received: by paulmck-ThinkPad-W500 (Postfix, from userid 1000) id 2F867E527B; Fri, 15 Jun 2012 14:06:12 -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, patches@linaro.org, "Paul E. McKenney" Subject: [PATCH tip/core/rcu 02/15] rcu: Size rcu_node tree from nr_cpu_ids rather than NR_CPUS Date: Fri, 15 Jun 2012 14:05:57 -0700 Message-Id: <1339794370-28119-2-git-send-email-paulmck@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.8 In-Reply-To: <1339794370-28119-1-git-send-email-paulmck@linux.vnet.ibm.com> References: <20120615210550.GA27506@linux.vnet.ibm.com> <1339794370-28119-1-git-send-email-paulmck@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12061521-7282-0000-0000-000009F3F8F5 X-Gm-Message-State: ALoCoQkrcGq/TH2XNFE13wOyeXMY9Z8YMl6YdefSjbLOUtiBgXY25Eqzv6sXlfjsJt9EU6ma5zyI 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 a151184..9098910 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 e9b44c3..7cb86ae 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.\n"); + 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