Skip to content

Commit

Permalink
x86: clean up stack allocation and free
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
clameter@sgi.com authored and Ingo Molnar committed Jan 30, 2008
1 parent ec12fa5 commit 6ea8bad
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions include/asm-x86/thread_info_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__ */
Expand Down

0 comments on commit 6ea8bad

Please sign in to comment.