diff options
author | Nicolas Pitre <nicolas.pitre@linaro.org> | 2017-10-03 18:29:49 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2017-10-04 09:53:32 -0400 |
commit | 438a50618095061920d3a30d4c5ca1ef2e0ff860 (patch) | |
tree | 71fd9e344473b605be6c9eac1cc6dab957dca3d2 | |
parent | d81fa669e3de7eb8a631d7d95dac5fbcb2bf9d4e (diff) |
percpu: don't forget to free the temporary struct pcpu_alloc_info
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>
-rw-r--r-- | mm/percpu.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/percpu.c b/mm/percpu.c index aa121cef76de..b9691d946fdc 100644 --- a/mm/percpu.c +++ b/mm/percpu.c | |||
@@ -1851,7 +1851,7 @@ struct pcpu_alloc_info * __init pcpu_alloc_alloc_info(int nr_groups, | |||
1851 | __alignof__(ai->groups[0].cpu_map[0])); | 1851 | __alignof__(ai->groups[0].cpu_map[0])); |
1852 | ai_size = base_size + nr_units * sizeof(ai->groups[0].cpu_map[0]); | 1852 | ai_size = base_size + nr_units * sizeof(ai->groups[0].cpu_map[0]); |
1853 | 1853 | ||
1854 | ptr = memblock_virt_alloc_nopanic(PFN_ALIGN(ai_size), 0); | 1854 | ptr = memblock_virt_alloc_nopanic(PFN_ALIGN(ai_size), PAGE_SIZE); |
1855 | if (!ptr) | 1855 | if (!ptr) |
1856 | return NULL; | 1856 | return NULL; |
1857 | ai = ptr; | 1857 | ai = ptr; |
@@ -2714,6 +2714,7 @@ void __init setup_per_cpu_areas(void) | |||
2714 | 2714 | ||
2715 | if (pcpu_setup_first_chunk(ai, fc) < 0) | 2715 | if (pcpu_setup_first_chunk(ai, fc) < 0) |
2716 | panic("Failed to initialize percpu areas."); | 2716 | panic("Failed to initialize percpu areas."); |
2717 | pcpu_free_alloc_info(ai); | ||
2717 | } | 2718 | } |
2718 | 2719 | ||
2719 | #endif /* CONFIG_SMP */ | 2720 | #endif /* CONFIG_SMP */ |