[PATCH 72/89] sched/headers: Move kstack_end() from to

Ingo Molnar
2017-02-06T13:35:30Z

... and update usage sites, where necessary.

Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/m32r/kernel/traps.c | 2 ++
arch/metag/kernel/stacktrace.c | 1 +
arch/openrisc/kernel/traps.c | 1 +
arch/um/kernel/sysrq.c | 1 +
arch/xtensa/kernel/traps.c | 1 +
include/linux/sched.h | 10 ----------
include/linux/sched/task_stack.h | 10 ++++++++++
mm/slab.c | 1 +
8 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/arch/m32r/kernel/traps.c b/arch/m32r/kernel/traps.c
index 7c05bb393597..832bb2bb29bd 100644
--- a/arch/m32r/kernel/traps.c
+++ b/arch/m32r/kernel/traps.c
@@ -15,7 +15,9 @@
#include <linux/stddef.h>
#include <linux/ptrace.h>
#include <linux/sched/debug.h>
+#include <linux/sched/task_stack.h>
#include <linux/mm.h>
+
#include <asm/page.h>
#include <asm/processor.h>

diff --git a/arch/metag/kernel/stacktrace.c b/arch/metag/kernel/stacktrace.c
index 4f806d66a58c..91ffc4b75c33 100644
--- a/arch/metag/kernel/stacktrace.c
+++ b/arch/metag/kernel/stacktrace.c
@@ -1,6 +1,7 @@
#include <linux/export.h>
#include <linux/sched.h>
#include <linux/sched/debug.h>
+#include <linux/sched/task_stack.h>
#include <linux/stacktrace.h>

#include <asm/stacktrace.h>
diff --git a/arch/openrisc/kernel/traps.c b/arch/openrisc/kernel/traps.c
index d220d385dd5d..faba2e7b8a05 100644
--- a/arch/openrisc/kernel/traps.c
+++ b/arch/openrisc/kernel/traps.c
@@ -23,6 +23,7 @@
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/sched/debug.h>
+#include <linux/sched/task_stack.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/kmod.h>
diff --git a/arch/um/kernel/sysrq.c b/arch/um/kernel/sysrq.c
index 34ae555c3e70..a76295f7ede9 100644
--- a/arch/um/kernel/sysrq.c
+++ b/arch/um/kernel/sysrq.c
@@ -12,6 +12,7 @@
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/sched/debug.h>
+#include <linux/sched/task_stack.h>

#include <asm/sysrq.h>
#include <asm/stacktrace.h>
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c
index d8bb2e62393e..c82c43bff296 100644
--- a/arch/xtensa/kernel/traps.c
+++ b/arch/xtensa/kernel/traps.c
@@ -26,6 +26,7 @@
#include <linux/kernel.h>
#include <linux/sched/signal.h>
#include <linux/sched/debug.h>
+#include <linux/sched/task_stack.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/stringify.h>
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 7dcda4726b30..cad9d218d942 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1344,16 +1344,6 @@ static inline struct thread_info *task_thread_info(struct task_struct *task)
# define task_thread_info(task) ((struct thread_info *)(task)->stack)
#endif

-#ifndef __HAVE_ARCH_KSTACK_END
-static inline int kstack_end(void *addr)
-{
- /* Reliable end of stack detection:
- * Some APM bios versions misalign the stack
- */
- return !(((unsigned long)addr+sizeof(void*)-1) & (THREAD_SIZE-sizeof(void*)));
-}
-#endif
-
/*
* find a task by one of its numerical ids
*
diff --git a/include/linux/sched/task_stack.h b/include/linux/sched/task_stack.h
index 1f4858a1e201..d4637d26c067 100644
--- a/include/linux/sched/task_stack.h
+++ b/include/linux/sched/task_stack.h
@@ -107,4 +107,14 @@ static inline unsigned long stack_not_used(struct task_struct *p)
#endif
extern void set_task_stack_end_magic(struct task_struct *tsk);

+#ifndef __HAVE_ARCH_KSTACK_END
+static inline int kstack_end(void *addr)
+{
+ /* Reliable end of stack detection:
+ * Some APM bios versions misalign the stack
+ */
+ return !(((unsigned long)addr+sizeof(void*)-1) & (THREAD_SIZE-sizeof(void*)));
+}
+#endif
+
#endif /* _LINUX_SCHED_TASK_STACK_H */
diff --git a/mm/slab.c b/mm/slab.c
index 4f2ec6bb46eb..535e1787cab8 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -116,6 +116,7 @@
#include <linux/kmemcheck.h>
#include <linux/memory.h>
#include <linux/prefetch.h>
+#include <linux/sched/task_stack.h>

#include <net/sock.h>

--
2.7.4