X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=blobdiff_plain;f=mm%2Fpercpu.c;h=e29a1c4f25a3f8e407fe174f1bd771b61552149e;hp=716eb4acf2fc29cf9500ad3972eb00b5413ab446;hb=ba895cc68b8cd42daa559576783af546fd79d59b;hpb=c63c4edcc8cf0f1ed2c6a1c9ba7a56bc50aa8199 diff --git a/mm/percpu.c b/mm/percpu.c index 716eb4acf2fc..e29a1c4f25a3 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -1642,6 +1642,16 @@ int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size, areas[group] = ptr; base = min(ptr, base); + } + + /* + * Copy data and free unused parts. This should happen after all + * allocations are complete; otherwise, we may end up with + * overlapping groups. + */ + for (group = 0; group < ai->nr_groups; group++) { + struct pcpu_group_info *gi = &ai->groups[group]; + void *ptr = areas[group]; for (i = 0; i < gi->nr_units; i++, ptr += ai->unit_size) { if (gi->cpu_map[i] == NR_CPUS) { @@ -1885,6 +1895,8 @@ void __init setup_per_cpu_areas(void) if (pcpu_setup_first_chunk(ai, fc) < 0) panic("Failed to initialize percpu areas."); + + pcpu_free_alloc_info(ai); } #endif /* CONFIG_SMP */