Commit 0017c869 authored by Tejun Heo's avatar Tejun Heo

x86: ensure percpu lpage doesn't consume too much vmalloc space

On extreme configuration (e.g. 32bit 32-way NUMA machine), lpage
percpu first chunk allocator can consume too much of vmalloc space.
Make it fall back to 4k allocator if the consumption goes over 20%.

[ Impact: add sanity check for lpage percpu first chunk allocator ]
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Reported-by: default avatarJan Beulich <JBeulich@novell.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Ingo Molnar <mingo@elte.hu>
parent fa8a7094
...@@ -163,9 +163,21 @@ static ssize_t __init setup_pcpu_lpage(size_t static_size, bool chosen) ...@@ -163,9 +163,21 @@ static ssize_t __init setup_pcpu_lpage(size_t static_size, bool chosen)
int i, j; int i, j;
ssize_t ret; ssize_t ret;
/* on non-NUMA, embedding is better */ if (!chosen) {
if (!chosen && !pcpu_need_numa()) size_t vm_size = VMALLOC_END - VMALLOC_START;
return -EINVAL; size_t tot_size = num_possible_cpus() * PMD_SIZE;
/* on non-NUMA, embedding is better */
if (!pcpu_need_numa())
return -EINVAL;
/* don't consume more than 20% of vmalloc area */
if (tot_size > vm_size / 5) {
pr_info("PERCPU: too large chunk size %zuMB for "
"large page remap\n", tot_size >> 20);
return -EINVAL;
}
}
/* need PSE */ /* need PSE */
if (!cpu_has_pse) { if (!cpu_has_pse) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment