aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sched.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r--include/linux/sched.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 5c2c885ee52b..1f07040d28e3 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2608,9 +2608,22 @@ static inline void setup_thread_stack(struct task_struct *p, struct task_struct
2608 task_thread_info(p)->task = p; 2608 task_thread_info(p)->task = p;
2609} 2609}
2610 2610
2611/*
2612 * Return the address of the last usable long on the stack.
2613 *
2614 * When the stack grows down, this is just above the thread
2615 * info struct. Going any lower will corrupt the threadinfo.
2616 *
2617 * When the stack grows up, this is the highest address.
2618 * Beyond that position, we corrupt data on the next page.
2619 */
2611static inline unsigned long *end_of_stack(struct task_struct *p) 2620static inline unsigned long *end_of_stack(struct task_struct *p)
2612{ 2621{
2622#ifdef CONFIG_STACK_GROWSUP
2623 return (unsigned long *)((unsigned long)task_thread_info(p) + THREAD_SIZE) - 1;
2624#else
2613 return (unsigned long *)(task_thread_info(p) + 1); 2625 return (unsigned long *)(task_thread_info(p) + 1);
2626#endif
2614} 2627}
2615 2628
2616#endif 2629#endif