diff options
| author | Rusty Russell <rusty@rustcorp.com.au> | 2002-03-04 23:04:15 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@penguin.transmeta.com> | 2002-03-04 23:04:15 -0800 |
| commit | 3d7af07825c07ddb3fbc27245ff01caae7ce764f (patch) | |
| tree | f151f055c01f6cbf1b4f0b5f6e261ed41f71743b /init | |
| parent | 09c1076ece2d7abd60356986436cc64c5253eb09 (diff) | |
[PATCH] per-cpu areas
This is the Richard Henderson-approved, cleaner, brighter per-cpu patch.
Diffstat (limited to 'init')
| -rw-r--r-- | init/main.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/init/main.c b/init/main.c index 9a810361e27a..524abe909c64 100644 --- a/init/main.c +++ b/init/main.c @@ -270,8 +270,32 @@ static void __init smp_init(void) #define smp_init() do { } while (0) #endif +static inline void setup_per_cpu_areas(void) +{ +} #else +#ifndef __HAVE_ARCH_PER_CPU +unsigned long __per_cpu_offset[NR_CPUS]; + +static void __init setup_per_cpu_areas(void) +{ + unsigned long size, i; + char *ptr; + /* Created by linker magic */ + extern char __per_cpu_start[], __per_cpu_end[]; + + /* Copy section for each CPU (we discard the original) */ + size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES); + 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); + } +} +#endif /* !__HAVE_ARCH_PER_CPU */ + /* Called by boot processor to activate the rest. */ static void __init smp_init(void) { @@ -314,6 +338,7 @@ asmlinkage void __init start_kernel(void) lock_kernel(); printk(linux_banner); setup_arch(&command_line); + setup_per_cpu_areas(); printk("Kernel command line: %s\n", saved_command_line); parse_options(command_line); trap_init(); |
