[13/18] x86_64: Allow fallback for the stack

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <akpm@...>
Cc: <linux-mm@...>, <linux-kernel@...>, <ak@...>, <travis@...>
Date: Wednesday, October 3, 2007 - 11:59 pm

Peter Zijlstra has recently demonstrated that we can have order 1 allocation
failures under memory pressure with small memory configurations. The
x86_64 stack has a size of 8k and thus requires a order 1 allocation.

This patch adds a virtual fallback capability for the stack. The system may
continue even in extreme situations and we may be able to increase the stack
size if necessary (see next patch).

Cc: ak@suse.de
Cc: travis@sgi.com
Signed-off-by: Christoph Lameter <clameter@sgi.com>

---
 include/asm-x86_64/thread_info.h |   16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

Index: linux-2.6/include/asm-x86_64/thread_info.h
===================================================================
--- linux-2.6.orig/include/asm-x86_64/thread_info.h	2007-10-03 14:49:48.000000000 -0700
+++ linux-2.6/include/asm-x86_64/thread_info.h	2007-10-03 14:51:00.000000000 -0700
@@ -74,20 +74,14 @@ static inline struct thread_info *stack_
 
 /* thread information allocation */
 #ifdef CONFIG_DEBUG_STACK_USAGE
-#define alloc_thread_info(tsk)					\
-    ({								\
-	struct thread_info *ret;				\
-								\
-	ret = ((struct thread_info *) __get_free_pages(GFP_KERNEL,THREAD_ORDER)); \
-	if (ret)						\
-		memset(ret, 0, THREAD_SIZE);			\
-	ret;							\
-    })
+#define THREAD_FLAGS (GFP_VFALLBACK | __GFP_ZERO)
 #else
-#define alloc_thread_info(tsk) \
-	((struct thread_info *) __get_free_pages(GFP_KERNEL,THREAD_ORDER))
+#define THREAD_FLAGS GFP_VFALLBACK
 #endif
 
+#define alloc_thread_info(tsk) \
+	((struct thread_info *) __get_free_pages(THREAD_FLAGS, THREAD_ORDER))
+
 #define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_ORDER)
 
 #else /* !__ASSEMBLY__ */

-- 
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[13/18] x86_64: Allow fallback for the stack, Christoph Lameter, (Wed Oct 3, 11:59 pm)
Re: [13/18] x86_64: Allow fallback for the stack, Andi Kleen, (Thu Oct 4, 7:56 am)
Re: [13/18] x86_64: Allow fallback for the stack, Christoph Lameter, (Thu Oct 4, 3:20 pm)
Re: [13/18] x86_64: Allow fallback for the stack, Rik van Riel, (Thu Oct 4, 3:39 pm)
Re: [13/18] x86_64: Allow fallback for the stack, Bill Davidsen, (Sat Oct 6, 2:53 pm)
Re: [13/18] x86_64: Allow fallback for the stack, Christoph Lameter, (Thu Oct 4, 5:20 pm)
Re: [13/18] x86_64: Allow fallback for the stack, Nick Piggin, (Sun Oct 7, 3:35 am)
Re: [13/18] x86_64: Allow fallback for the stack, Christoph Lameter, (Mon Oct 8, 1:36 pm)
Re: [13/18] x86_64: Allow fallback for the stack, Nick Piggin, (Mon Oct 8, 8:55 am)
Re: [13/18] x86_64: Allow fallback for the stack, Christoph Lameter, (Tue Oct 9, 2:39 pm)
Re: [13/18] x86_64: Allow fallback for the stack, Nick Piggin, (Tue Oct 9, 4:46 am)
Re: [13/18] x86_64: Allow fallback for the stack, Christoph Lameter, (Tue Oct 9, 9:26 pm)
Re: [13/18] x86_64: Allow fallback for the stack, Nick Piggin, (Tue Oct 9, 5:56 am)
Re: [13/18] x86_64: Allow fallback for the stack, Peter Zijlstra, (Thu Oct 4, 8:08 am)
Re: [13/18] x86_64: Allow fallback for the stack, Andi Kleen, (Thu Oct 4, 8:25 am)
Re: [13/18] x86_64: Allow fallback for the stack, Christoph Lameter, (Thu Oct 4, 1:40 pm)
Re: [13/18] x86_64: Allow fallback for the stack, Peter Zijlstra, (Thu Oct 4, 8:30 am)