X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=init%2Fmain.c;h=e81cf427d9c7a43d42b93ca2a8aed3a1ab64f089;hb=e7f5ed8d6e921c6200ce5e2549a86db629f2dd11;hp=638d3a78641298b02da226baa1438bc43fe863e9;hpb=3ddfda11861d305b02ed810b522dcf48b74ca808;p=deliverable%2Flinux.git diff --git a/init/main.c b/init/main.c index 638d3a786412..e81cf427d9c7 100644 --- a/init/main.c +++ b/init/main.c @@ -391,17 +391,23 @@ EXPORT_SYMBOL(__per_cpu_offset); static void __init setup_per_cpu_areas(void) { - unsigned long size, i; + unsigned long size, i, old_size; char *ptr; unsigned long nr_possible_cpus = num_possible_cpus(); + unsigned long align = 1; + unsigned da_size; /* Copy section for each CPU (we discard the original) */ - size = ALIGN(PERCPU_ENOUGH_ROOM, PAGE_SIZE); + old_size = PERCPU_ENOUGH_ROOM; + da_size = per_cpu_dyn_array_size(&align); + align = max_t(unsigned long, PAGE_SIZE, align); + size = ALIGN(old_size + da_size, align); ptr = alloc_bootmem_pages(size * nr_possible_cpus); for_each_possible_cpu(i) { __per_cpu_offset[i] = ptr - __per_cpu_start; memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); + per_cpu_alloc_dyn_array(i, ptr + old_size); ptr += size; } } @@ -536,29 +542,6 @@ void __init __weak thread_info_cache_init(void) { } -void pre_alloc_dyn_array(void) -{ -#ifdef CONFIG_HAVE_DYN_ARRAY - unsigned long size, phys = 0; - struct dyn_array **daa; - - for (daa = __dyn_array_start ; daa < __dyn_array_end; daa++) { - struct dyn_array *da = *daa; - - size = da->size * (*da->nr); - print_fn_descriptor_symbol("dyna_array %s ", da->name); - printk(KERN_CONT "size:%#lx nr:%d align:%#lx", - da->size, *da->nr, da->align); - *da->name = __alloc_bootmem(size, da->align, phys); - phys = virt_to_phys(*da->name); - printk(KERN_CONT " ==> [%#lx - %#lx]\n", phys, phys + size); - - if (da->init_work) - da->init_work(da); - } -#endif -} - asmlinkage void __init start_kernel(void) { char * command_line;