Merge branch 'for-3.4-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu

Pull percpu fixes from Tejun Heo:
 "This pull request contains two patches.  One is kmemleak annotation
  fix which isn't critical.  The other is kinda serious.

  Depending on NUMA topology, percpu allocator may end up assigning
  overlapping regions for the static percpu areas for different CPUs.
  While critical, the bug has been there for a very long time and only
  few configurations seem to be affected (NUMA configurations w/ no
  memory nodes for example) - so, while it's critical, it isn't exactly
  urgent."

* 'for-3.4-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu:
  kmemleak: Fix the kmemleak tracking of the percpu areas with !SMP
  percpu: pcpu_embed_first_chunk() should free unused parts after all allocs are complete
This commit is contained in:
Linus Torvalds 2012-05-10 14:59:50 -07:00
Родитель fda27bed90 100d13c3b5
Коммит f3b26922ec
1 изменённых файлов: 12 добавлений и 0 удалений

Просмотреть файл

@ -1650,6 +1650,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)
fc = __alloc_bootmem(unit_size, PAGE_SIZE, __pa(MAX_DMA_ADDRESS));
if (!ai || !fc)
panic("Failed to allocate memory for percpu areas.");
/* kmemleak tracks the percpu allocations separately */
kmemleak_free(fc);
ai->dyn_size = unit_size;
ai->unit_size = unit_size;