summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorAndrew Morton <akpm@digeo.com>2003-06-05 18:53:43 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2003-06-05 18:53:43 -0700
commit21af2f0289deade2a179d9cef01e3258ad7315c8 (patch)
tree4cb0d7a73649ccc8ac9c16de2553597f351e1fee /include/linux
parent32028c70312e801a6532c0766f97324528a4c3f6 (diff)
[PATCH] per-cpu support inside modules (minimal)
From: Rusty Russell <rusty@rustcorp.com.au> OK, this does the *minimum* required to support DEFINE_PER_CPU inside modules. If we decide to change kmalloc_percpu later, great, we can turf this out. Basically, overallocates the amount of per-cpu data at boot to at least PERCPU_ENOUGH_ROOM if CONFIG_MODULES=y (arch-specific by default 32k: I have only 7744 bytes of percpu data in my kernel here, so makes sense), and a special allocator in module.c dishes it out.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/module.h3
-rw-r--r--include/linux/percpu.h6
2 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/module.h b/include/linux/module.h
index 73e3de311d51..910f46f4e620 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -247,6 +247,9 @@ struct module
char *strtab;
#endif
+ /* Per-cpu data. */
+ void *percpu;
+
/* The command line arguments (may be mangled). People like
keeping pointers to this stuff */
char *args;
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 21e8c1aba942..9e637260e58f 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -2,9 +2,15 @@
#define __LINUX_PERCPU_H
#include <linux/spinlock.h> /* For preempt_disable() */
#include <linux/slab.h> /* For kmalloc() */
+#include <linux/smp.h>
#include <linux/string.h> /* For memset() */
#include <asm/percpu.h>
+/* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */
+#ifndef PERCPU_ENOUGH_ROOM
+#define PERCPU_ENOUGH_ROOM 32768
+#endif
+
/* Must be an lvalue. */
#define get_cpu_var(var) (*({ preempt_disable(); &__get_cpu_var(var); }))
#define put_cpu_var(var) preempt_enable()