x86: clean up stack allocation and free
authorclameter@sgi.com <clameter@sgi.com>
Wed, 30 Jan 2008 12:30:32 +0000 (13:30 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:30:32 +0000 (13:30 +0100)
Clean up the allocation and freeing of stacks a bit by using a __GFP_ZERO flag
instead of memset.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Mike Travis <travis@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/asm-x86/thread_info_64.h

index 7f6ee68f000203d17a6ee747e6df85a55535053b..1ac23c157231e4561edfe010b5cd2e0390776b8b 100644 (file)
@@ -74,20 +74,14 @@ static inline struct thread_info *stack_thread_info(void)
 
 /* 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_KERNEL | __GFP_ZERO)
 #else
-#define alloc_thread_info(tsk) \
-       ((struct thread_info *) __get_free_pages(GFP_KERNEL,THREAD_ORDER))
+#define THREAD_FLAGS GFP_KERNEL
 #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__ */