All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Hansen <haveblue@us.ibm.com>
To: benh@kernel.crashing.org
Cc: Arjan van de Ven <arjanv@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCHES] (4/4) stack updates for x86
Date: Mon, 09 Dec 2002 14:09:37 -0800	[thread overview]
Message-ID: <3DF514A1.9070502@us.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 278 bytes --]

The kernel currently uses an 8k stack, per task.  Here is the
infrastructure needed to allow us to halve that.

D-4k-stack-2.5.50+bk-5.patch
	make a config option to turn on 4k stacks.  (there appears to
	be a problem with this right now).

-- 
Dave Hansen
haveblue@us.ibm.com


[-- Attachment #2: D-4k-stack-2.5.50+bk-5.patch --]
[-- Type: text/plain, Size: 2261 bytes --]

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.862   -> 1.864  
#	include/asm-i386/thread_info.h	1.13    -> 1.15   
#	   arch/i386/Kconfig	1.15    -> 1.16   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/12/09	haveblue@elm3b96.(none)	1.863
# Merge elm3b96.(none):/work/dave/bk/linux-2.5-stack_size-config
# into elm3b96.(none):/work/dave/bk/linux-2.5-4k_stack
# --------------------------------------------
# 02/12/09	haveblue@elm3b96.(none)	1.864
# thread_info.h:
#   do sane overflow detection with 4k stack
# --------------------------------------------
#
diff -Nru a/arch/i386/Kconfig b/arch/i386/Kconfig
--- a/arch/i386/Kconfig	Mon Dec  9 13:33:26 2002
+++ b/arch/i386/Kconfig	Mon Dec  9 13:33:26 2002
@@ -720,6 +720,16 @@
 	  low memory.  Setting this option will put user-space page table
 	  entries in high memory.
 
+config 4K_STACK
+	bool "Use smaller 4k per-task stacks"
+	help
+	  This option will shrink the kernel's per-task stack from 8k to
+	  4k.  This will greatly increase your chance of overflowing it.
+	  But, if you use the per-cpu interrupt stacks as well, your chances
+	  go way down.  Also try the CONFIG_X86_STACK_CHECK overflow
+	  detection.  It is much more reliable than the currently in-kernel
+	  version.
+
 config MATH_EMULATION
 	bool "Math emulation"
 	---help---
diff -Nru a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h
--- a/include/asm-i386/thread_info.h	Mon Dec  9 13:33:26 2002
+++ b/include/asm-i386/thread_info.h	Mon Dec  9 13:33:26 2002
@@ -61,10 +61,16 @@
  *
  * preempt_count needs to be 1 initially, until the scheduler is functional.
  */
-#define THREAD_ORDER 1 
+#ifdef CONFIG_4K_STACK
+#define THREAD_ORDER 0
+#define STACK_WARN		0x200
+#define STACK_PANIC		0x100
+#else
+#define THREAD_ORDER 1
+#define STACK_WARN              ((THREAD_SIZE)>>1)
+#define STACK_PANIC             0x100
+#endif
 #define INIT_THREAD_SIZE       THREAD_SIZE
-#define STACK_PANIC		0x200ul
-#define STACK_WARN		((THREAD_SIZE)>>1)
 
 #ifndef __ASSEMBLY__
 

                 reply	other threads:[~2002-12-09 22:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3DF514A1.9070502@us.ibm.com \
    --to=haveblue@us.ibm.com \
    --cc=arjanv@redhat.com \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.