[Devel] [PATCH rh7] arch/x86_64: increase kernel stack size up to 16K on debug kernels

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jun 19 05:23:53 PDT 2015


This is a port of
diff-arch-x86_64-increase-kernel-stack-size-up-to-16K-on-debug-kernels
from 2.6.32-x kernel.

arch: x86_64: increase kernel stack size up to 16K on debug kernels

Debug kernels add a lot of stuff to various structures increasing kernel
stack usage. To avoid spurious stack overruns, let's increase kernel
stack size up to 16K on debug kernels.

https://jira.sw.ru/browse/PSBM-28515

Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>

We really don't want to spend time investigating stack overflows
on debug kernels, so let's apply it from the very beginning.

https://jira.sw.ru/browse/PSBM-29199

Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 arch/x86/Kconfig.debug               | 4 ++++
 arch/x86/include/asm/page_64_types.h | 7 ++++++-
 config.OpenVZ                        | 5 +++++
 config.OpenVZ.debug                  | 5 +++++
 4 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index c198b7e..74294a3 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -119,6 +119,10 @@ config DEBUG_NX_TEST
 	  and the software setup of this feature.
 	  If in doubt, say "N"
 
+config 16KSTACKS
+	bool "Use 16Kb for kernel stacks instead of 8Kb"
+	depends on X86_64
+
 config DOUBLEFAULT
 	default y
 	bool "Enable doublefault exception handler" if EXPERT
diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h
index 970f309..490df4b 100644
--- a/arch/x86/include/asm/page_64_types.h
+++ b/arch/x86/include/asm/page_64_types.h
@@ -1,7 +1,12 @@
 #ifndef _ASM_X86_PAGE_64_DEFS_H
 #define _ASM_X86_PAGE_64_DEFS_H
 
-#define THREAD_SIZE_ORDER	1
+#ifdef CONFIG_16KSTACKS
+# define THREAD_SIZE_ORDER	2
+#else
+# define THREAD_SIZE_ORDER	1
+#endif
+
 #define THREAD_SIZE  (PAGE_SIZE << THREAD_SIZE_ORDER)
 #define CURRENT_MASK (~(THREAD_SIZE - 1))
 
diff --git a/config.OpenVZ b/config.OpenVZ
index e3d9158..41aacd4 100644
--- a/config.OpenVZ
+++ b/config.OpenVZ
@@ -5303,3 +5303,8 @@ CONFIG_BEANCOUNTERS=y
 CONFIG_BC_IO_ACCOUNTING=y
 CONFIG_BC_IO_PRIORITY=y
 CONFIG_BC_PROC=y
+
+#
+# Debug
+#
+# CONFIG_16KSTACKS is not set
diff --git a/config.OpenVZ.debug b/config.OpenVZ.debug
index 4ff91bf..8e0e0f9 100644
--- a/config.OpenVZ.debug
+++ b/config.OpenVZ.debug
@@ -5414,3 +5414,8 @@ CONFIG_BEANCOUNTERS=y
 CONFIG_BC_IO_ACCOUNTING=y
 CONFIG_BC_IO_PRIORITY=y
 CONFIG_BC_PROC=y
+
+#
+# Debug
+#
+CONFIG_16KSTACKS=y
-- 
1.8.3.1




More information about the Devel mailing list