public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Andrew Morton <akpm@osdl.org>
Cc: Andi Kleen <ak@suse.de>, "Randy.Dunlap" <rdunlap@xenotime.net>,
	"Protasevich, Natalie" <Natalie.Protasevich@unisys.com>,
	linux-kernel@vger.kernel.org,
	Arjan van de Ven <arjan@infradead.org>
Subject: [PATCH] x86_64:  Auto size the per cpu area.
Date: Mon, 07 Aug 2006 23:47:23 -0600	[thread overview]
Message-ID: <m13bc7aidw.fsf_-_@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <1155005284.3042.11.camel@laptopd505.fenrus.org> (Arjan van de Ven's message of "Tue, 08 Aug 2006 04:47:49 +0200")


Now for a completely different but trivial approach.
I just boot tested it with 255 CPUS and everything worked.

Currently everything (except module data) we place in
the per cpu area we know about at compile time.  So
instead of allocating a fixed size for the per_cpu area
allocate the number of bytes we need plus a fixed constant
for to be used for modules.

It isn't perfect but it is much less of a pain to
work with than what we are doing now.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 arch/x86_64/kernel/setup64.c |    7 ++-----
 include/asm-x86_64/percpu.h  |   10 ++++++++++
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c
index 0cd3694..94336cf 100644
--- a/arch/x86_64/kernel/setup64.c
+++ b/arch/x86_64/kernel/setup64.c
@@ -95,12 +95,9 @@ #ifdef CONFIG_HOTPLUG_CPU
 #endif
 
 	/* Copy section for each CPU (we discard the original) */
-	size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES);
-#ifdef CONFIG_MODULES
-	if (size < PERCPU_ENOUGH_ROOM)
-		size = PERCPU_ENOUGH_ROOM;
-#endif
+	size = PERCPU_ENOUGH_ROOM;
 
+	printk(KERN_INFO "PERCPU: Allocating %d bytes of per cpu data\n", size);
 	for_each_cpu_mask (i, cpu_possible_map) {
 		char *ptr;
 
diff --git a/include/asm-x86_64/percpu.h b/include/asm-x86_64/percpu.h
index 08dd9f9..39d2bab 100644
--- a/include/asm-x86_64/percpu.h
+++ b/include/asm-x86_64/percpu.h
@@ -11,6 +11,16 @@ #ifdef CONFIG_SMP
 
 #include <asm/pda.h>
 
+#ifdef CONFIG_MODULES
+# define PERCPU_MODULE_RESERVE 8192
+#else
+# define PERCPU_MODULE_RESERVE 0
+#endif
+
+#define PERCPU_ENOUGH_ROOM \
+	(ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \
+	 PERCPU_MODULE_RESERVE)
+
 #define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset)
 #define __my_cpu_offset() read_pda(data_offset)
 
-- 
1.4.2.rc3.g7e18e


  reply	other threads:[~2006-08-08  5:48 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-07 15:26 [PATCH] x86_64: Make NR_IRQS configurable in Kconfig Eric W. Biederman
2006-08-07 15:33 ` Andi Kleen
2006-08-07 15:55   ` Eric W. Biederman
2006-08-07 15:59 ` Randy.Dunlap
2006-08-07 16:11   ` Protasevich, Natalie
2006-08-07 16:17     ` Andi Kleen
2006-08-07 16:23       ` Protasevich, Natalie
2006-08-07 16:58       ` Eric W. Biederman
2006-08-07 16:44   ` Eric W. Biederman
2006-08-07 17:00     ` H. Peter Anvin
2006-08-07 17:46       ` Eric W. Biederman
2006-08-07 17:52         ` H. Peter Anvin
2006-08-07 17:30   ` Eric W. Biederman
2006-08-07 17:55     ` Randy.Dunlap
2006-08-07 18:16       ` Eric W. Biederman
2006-08-07 18:53       ` Eric W. Biederman
2006-08-07 19:04         ` Randy.Dunlap
2006-08-07 22:10           ` Eric W. Biederman
2006-08-07 23:55             ` Andrew Morton
2006-08-08  2:17               ` Andi Kleen
2006-08-08  2:41                 ` Andrew Morton
2006-08-08  2:47                   ` Arjan van de Ven
2006-08-08  5:47                     ` Eric W. Biederman [this message]
2006-08-08  6:01                       ` [PATCH] x86_64: Auto size the per cpu area Andrew Morton
2006-08-08  6:31                         ` Eric W. Biederman
2006-08-08  6:01                       ` Andi Kleen
2006-08-08  6:46                         ` Eric W. Biederman
2006-08-08  6:48                           ` Andi Kleen
2006-08-08  7:29                             ` Eric W. Biederman
2006-08-08  5:09                   ` [PATCH] x86_64: Make NR_IRQS configurable in Kconfig Paul Mackerras
2006-08-08  5:14                     ` Andi Kleen
2006-08-08  8:17                       ` Martin Schwidefsky
2006-08-09 17:58                         ` Luck, Tony
2006-08-09 18:25                           ` Dave Hansen
2006-08-10 12:55                             ` Martin Schwidefsky
2006-08-10 14:40                               ` Andy Whitcroft
2006-08-10 14:53                                 ` Martin Schwidefsky
2006-08-07 19:40         ` Adrian Bunk
2006-08-07 22:26           ` Eric W. Biederman
2006-08-07 23:06             ` Adrian Bunk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m13bc7aidw.fsf_-_@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=Natalie.Protasevich@unisys.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@xenotime.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox