Skip to contentSkip to conversation

fork: make number of cached stacks (vmapped) configurable using Kbuild

PATCH In review Hoeun Ryu 1 participant 1 message Feb 3, 2017

Subsystems (3)
lore
Share & tools
lore

Hoeun Ryu

author
#0 lore raw

PATCH 2/3 fork: make number of cached stacks (vmapped) configurable using Kbuild

Introducing NR_VMAP_STACK_CACHE, the number of cached stacks for virtually mapped kernel stack can be configurable using Kbuild system. default value is 2.

---
 arch/Kconfig  | 8 ++++++++
 kernel/fork.c | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)
arch/Kconfig +8 -0
index d49a8e6..e94c432 100644
@@ -849,6 +849,14 @@ config VMAP_STACK
 	  the stack to map directly to the KASAN shadow map using a formula
 	  that is incorrect if the stack is in vmalloc space.
 
+config NR_VMAP_STACK_CACHE
+	int "Number of cached stacks"
+	default "2"
+	depends on VMAP_STACK
+	---help---
+	  This determines how many stacks can be cached for virtually
+	  mapped kernel stacks.
+
 config ARCH_WANT_RELAX_ORDER
 	bool
 
kernel/fork.c +1 -1
index 54421a9..50de6cf 100644
@@ -166,7 +166,7 @@ void __weak arch_release_thread_stack(unsigned long *stack)
  * vmalloc() is a bit slow, and calling vfree() enough times will force a TLB
  * flush.  Try to minimize the number of calls by caching stacks.
  */
-#define NR_CACHED_STACKS 2
+#define NR_CACHED_STACKS CONFIG_NR_VMAP_STACK_CACHE
 
 struct vm_stack_cache {
 	struct vm_struct **vm_stacks;
Signature · 1 line
2.7.4