diff options
author | Andrew Morton <akpm@digeo.com> | 2003-06-05 18:53:43 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@home.transmeta.com> | 2003-06-05 18:53:43 -0700 |
commit | 21af2f0289deade2a179d9cef01e3258ad7315c8 (patch) | |
tree | 4cb0d7a73649ccc8ac9c16de2553597f351e1fee /init | |
parent | 32028c70312e801a6532c0766f97324528a4c3f6 (diff) | |
download | history-21af2f0289deade2a179d9cef01e3258ad7315c8.tar.gz |
[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 'init')
-rw-r--r-- | init/main.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/init/main.c b/init/main.c index 74e083a3fcf50f..d7e2df3f7f1f0f 100644 --- a/init/main.c +++ b/init/main.c @@ -318,14 +318,16 @@ static void __init setup_per_cpu_areas(void) /* Copy section for each CPU (we discard the original) */ size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES); - if (!size) - return; +#ifdef CONFIG_MODULES + if (size < PERCPU_ENOUGH_ROOM) + size = PERCPU_ENOUGH_ROOM; +#endif ptr = alloc_bootmem(size * NR_CPUS); for (i = 0; i < NR_CPUS; i++, ptr += size) { __per_cpu_offset[i] = ptr - __per_cpu_start; - memcpy(ptr, __per_cpu_start, size); + memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); } } #endif /* !__GENERIC_PER_CPU */ |