Skip to content

Commit

Permalink
percpu: don't forget to free the temporary struct pcpu_alloc_info
Browse files Browse the repository at this point in the history
Unlike the SMP case, the !SMP case does not free the memory for struct
pcpu_alloc_info allocated in setup_per_cpu_areas(). And to give it a
chance of being reused by the page allocator later, align it to a page
boundary just like its size.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
Acked-by: Dennis Zhou <dennisszhou@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
  • Loading branch information
Nicolas Pitre authored and Tejun Heo committed Oct 4, 2017
1 parent d81fa66 commit 438a506
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mm/percpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1851,7 +1851,7 @@ struct pcpu_alloc_info * __init pcpu_alloc_alloc_info(int nr_groups,
__alignof__(ai->groups[0].cpu_map[0]));
ai_size = base_size + nr_units * sizeof(ai->groups[0].cpu_map[0]);

ptr = memblock_virt_alloc_nopanic(PFN_ALIGN(ai_size), 0);
ptr = memblock_virt_alloc_nopanic(PFN_ALIGN(ai_size), PAGE_SIZE);
if (!ptr)
return NULL;
ai = ptr;
Expand Down Expand Up @@ -2714,6 +2714,7 @@ 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 */
Expand Down

0 comments on commit 438a506

Please sign in to comment.