From b85b3f46843797863ec8b329dd30b42fdf03c207 Mon Sep 17 00:00:00 2001 From: Zhenhua Huang Date: Thu, 21 Jun 2018 12:54:40 +0800 Subject: [PATCH] mm: Kconfig: Add support for config size of purging vmap_area This size is the maximum amount of virtual address space we gather up before attempting to purge with a TLB flush. It is 128M in most cases. With repeated and high size vmalloc operations, it may easily generate more fragments. This is wasting limited vmalloc area, for 32bits. So make it configable and the default multiplier as 8, 32bits only. Change-Id: I68a75acb16d3cff05f8b13c05ae78922269e219f Signed-off-by: Zhenhua Huang --- mm/Kconfig | 10 ++++++++++ mm/vmalloc.c | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/mm/Kconfig b/mm/Kconfig index 9b9651d302d5..d02e896f381e 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -628,6 +628,16 @@ config ZSMALLOC_STAT information to userspace via debugfs. If unsure, say N. +config VMAP_LAZY_PURGING_FACTOR + int "multiplier to the size of purged vmap areas" + default "8" if ARM + default "32" + help + It is used as a multiplier to the max VA pages purged in a + single attempt. For 32-bit in order to reduce fragmentation + of vmalloc space, we decrease the default value to "8". + + config GENERIC_EARLY_IOREMAP bool diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 66e394d0b8a0..8e3188fe134e 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1260,7 +1260,8 @@ static unsigned long lazy_max_pages(void) log = fls(num_online_cpus()); - return log * (32UL * 1024 * 1024 / PAGE_SIZE); + return log * (1UL * CONFIG_VMAP_LAZY_PURGING_FACTOR * + 1024 * 1024 / PAGE_SIZE); } static atomic_long_t vmap_lazy_nr = ATOMIC_LONG_INIT(0);