[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1545208502-7941-1-git-send-email-maninder1.s@samsung.com>
Date: Wed, 19 Dec 2018 14:05:02 +0530
From: Maninder Singh <maninder1.s@...sung.com>
To: linux-kernel@...r.kernel.org, luto@...nel.org
Cc: a.sahrawat@...sung.com, pankaj.m@...sung.com,
Maninder Singh <maninder1.s@...sung.com>,
Vaneet Narang <v.narang@...sung.com>
Subject: [PATCH 1/1] task_stack: make code generic for getting end of stack.
currently code provides end of stack by considering stack grows
downwards. Make it useful for architectures where stack grows upward.
Although CONFIG_THREAD_INFO_IN_TASK is selected only for
architectures where stack grows downward.
Signed-off-by: Maninder Singh <maninder1.s@...sung.com>
Signed-off-by: Vaneet Narang <v.narang@...sung.com>
---
include/linux/sched/task_stack.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/linux/sched/task_stack.h b/include/linux/sched/task_stack.h
index 6a84192..4f099d3 100644
--- a/include/linux/sched/task_stack.h
+++ b/include/linux/sched/task_stack.h
@@ -25,7 +25,11 @@ static inline void *task_stack_page(const struct task_struct *task)
static inline unsigned long *end_of_stack(const struct task_struct *task)
{
+#ifdef CONFIG_STACK_GROWSUP
+ return (unsigned long *)((unsigned long)task->stack + THREAD_SIZE) - 1;
+#else
return task->stack;
+#endif
}
#elif !defined(__HAVE_THREAD_FUNCTIONS)
--
1.9.1
Powered by blists - more mailing lists