Re: [patch 1/4] Make the per cpu reserve configurable

Previous thread: [patch 0/4] Cpu alloc V5: Replace percpu allocator in modules.c by Christoph Lameter on Friday, September 19, 2008 - 7:58 am. (3 messages)

Next thread: [patch 2/4] percpu: Rename variables PERCPU_ENOUGH_ROOM -> PERCPU_AREA_SIZE by Christoph Lameter on Friday, September 19, 2008 - 7:59 am. (1 message)
From: Christoph Lameter
Date: Friday, September 19, 2008 - 7:59 am

The per cpu reserve from which loadable modules allocate their percpu sections
is currently fixed at 8000 bytes.

Add a new kernel parameter

	percpu=<dynamically allocatable percpu bytes>

The per cpu reserve area will be used in following patches by the
per cpu allocator.

Signed-off-by: Christoph Lameter <cl@linux-foundation.org>

---
 arch/ia64/include/asm/percpu.h |    1 +
 include/linux/percpu.h         |    7 ++++++-
 init/main.c                    |   13 +++++++++++++
 3 files changed, 20 insertions(+), 1 deletion(-)

Index: linux-2.6/include/linux/percpu.h
===================================================================
--- linux-2.6.orig/include/linux/percpu.h	2008-09-16 18:14:58.000000000 -0700
+++ linux-2.6/include/linux/percpu.h	2008-09-16 18:21:01.000000000 -0700
@@ -34,6 +34,7 @@
 #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
 #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
 
+extern unsigned int percpu_reserve;
 /* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */
 #ifndef PERCPU_ENOUGH_ROOM
 #ifdef CONFIG_MODULES
@@ -43,7 +44,7 @@
 #endif
 
 #define PERCPU_ENOUGH_ROOM						\
-	(__per_cpu_end - __per_cpu_start + PERCPU_MODULE_RESERVE)
+	(__per_cpu_end - __per_cpu_start + percpu_reserve)
 #endif	/* PERCPU_ENOUGH_ROOM */
 
 /*
Index: linux-2.6/init/main.c
===================================================================
--- linux-2.6.orig/init/main.c	2008-09-16 18:14:59.000000000 -0700
+++ linux-2.6/init/main.c	2008-09-16 18:24:12.000000000 -0700
@@ -253,6 +253,16 @@ static int __init loglevel(char *str)
 
 early_param("loglevel", loglevel);
 
+unsigned int percpu_reserve = PERCPU_MODULE_RESERVE;
+
+static int __init init_percpu_reserve(char *str)
+{
+	get_option(&str, &percpu_reserve);
+	return 0;
+}
+
+early_param("percpu=", init_percpu_reserve);
+
 /*
  * Unknown boot options get handed to init, unless they look like
  * failed parameters
@@ -397,6 +407,9 @@ static ...
From: KAMEZAWA Hiroyuki
Date: Friday, September 19, 2008 - 8:55 pm

On Fri, 19 Sep 2008 07:59:00 -0700

Is this PERCPU_MODULE_RESERVE default size is fixex to 8192 bytes
both on 32bit-arch and 64bit-arch ?
How about enlarging this to twice on 64bit arch now ?

sorry for noise.

Thanks,

--

From: Christoph Lameter
Date: Saturday, September 20, 2008 - 4:15 pm

No actually a good idea to discuss the limit here. Maybe use 10000 for 32 bit and 15000 for 64 bit? Many percpu variables are counters that may be integers.



--

Previous thread: [patch 0/4] Cpu alloc V5: Replace percpu allocator in modules.c by Christoph Lameter on Friday, September 19, 2008 - 7:58 am. (3 messages)

Next thread: [patch 2/4] percpu: Rename variables PERCPU_ENOUGH_ROOM -> PERCPU_AREA_SIZE by Christoph Lameter on Friday, September 19, 2008 - 7:59 am. (1 message)