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 /include/asm-generic | |
| parent | 32028c70312e801a6532c0766f97324528a4c3f6 (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/asm-generic')
| -rw-r--r-- | include/asm-generic/percpu.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h index 961afc99b547..f13b44926e6a 100644 --- a/include/asm-generic/percpu.h +++ b/include/asm-generic/percpu.h @@ -8,22 +8,25 @@ extern unsigned long __per_cpu_offset[NR_CPUS]; /* Separate out the type, so (int[3], foo) works. */ -#ifndef MODULE #define DEFINE_PER_CPU(type, name) \ __attribute__((__section__(".data.percpu"))) __typeof__(type) name##__per_cpu -#endif /* var is in discarded region: offset to particular copy we want */ #define per_cpu(var, cpu) (*RELOC_HIDE(&var##__per_cpu, __per_cpu_offset[cpu])) #define __get_cpu_var(var) per_cpu(var, smp_processor_id()) +static inline void percpu_modcopy(void *pcpudst, const void *src, + unsigned long size) +{ + unsigned int i; + for (i = 0; i < NR_CPUS; i++) + if (cpu_possible(i)) + memcpy(pcpudst + __per_cpu_offset[i], src, size); +} #else /* ! SMP */ -/* Can't define per-cpu variables in modules. Sorry --RR */ -#ifndef MODULE #define DEFINE_PER_CPU(type, name) \ __typeof__(type) name##__per_cpu -#endif #define per_cpu(var, cpu) ((void)cpu, var##__per_cpu) #define __get_cpu_var(var) var##__per_cpu |
