dyn_array: split dyn_array functions from init/main.c
[deliverable/linux.git] / init / main.c
index 638d3a78641298b02da226baa1438bc43fe863e9..e81cf427d9c7a43d42b93ca2a8aed3a1ab64f089 100644 (file)
@@ -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;
This page took 0.04557 seconds and 5 git commands to generate.