[PATCH 65/89] sched/headers: Move 'init_task' and 'init_thread_union' from to

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

'init_task' is really not part of core scheduler APIs but part of
the fork() interface between the scheduler and process management.

So move the declarations - and update affected code.

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/arm64/kernel/setup.c | 1 +
arch/arm64/mm/kasan_init.c | 1 +
arch/frv/mm/init.c | 1 +
arch/metag/mm/init.c | 1 +
arch/nios2/kernel/setup.c | 1 +
arch/powerpc/kernel/paca.c | 1 +
arch/um/kernel/skas/process.c | 1 +
arch/um/kernel/um_arch.c | 2 ++
arch/x86/kernel/cpu/common.c | 1 +
arch/x86/mm/kasan_init_64.c | 1 +
fs/namespace.c | 2 ++
include/linux/sched.h | 3 ---
include/linux/sched/signal.h | 1 +
include/linux/sched/task.h | 8 ++++++--
init/init_task.c | 1 +
kernel/delayacct.c | 1 +
lib/is_single_threaded.c | 1 +
mm/vmacache.c | 1 +
18 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index b051367e2149..73e91be22dd4 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -42,6 +42,7 @@
#include <linux/of_fdt.h>
#include <linux/efi.h>
#include <linux/psci.h>
+#include <linux/sched/task.h>

#include <asm/acpi.h>
#include <asm/fixmap.h>
diff --git a/arch/arm64/mm/kasan_init.c b/arch/arm64/mm/kasan_init.c
index 757009daa9ed..ee972cd08e74 100644
--- a/arch/arm64/mm/kasan_init.c
+++ b/arch/arm64/mm/kasan_init.c
@@ -13,6 +13,7 @@
#define pr_fmt(fmt) "kasan: " fmt
#include <linux/kasan.h>
#include <linux/kernel.h>
+#include <linux/sched/task.h>
#include <linux/memblock.h>
#include <linux/start_kernel.h>

diff --git a/arch/frv/mm/init.c b/arch/frv/mm/init.c
index 88a159743528..328f0a292316 100644
--- a/arch/frv/mm/init.c
+++ b/arch/frv/mm/init.c
@@ -18,6 +18,7 @@

#include <linux/signal.h>
#include <linux/sched.h>
+#include <linux/sched/task.h>
#include <linux/pagemap.h>
#include <linux/gfp.h>
#include <linux/swap.h>
diff --git a/arch/metag/mm/init.c b/arch/metag/mm/init.c
index c0ec116b3993..188d4d9fbed4 100644
--- a/arch/metag/mm/init.c
+++ b/arch/metag/mm/init.c
@@ -12,6 +12,7 @@
#include <linux/percpu.h>
#include <linux/memblock.h>
#include <linux/initrd.h>
+#include <linux/sched/task.h>

#include <asm/setup.h>
#include <asm/page.h>
diff --git a/arch/nios2/kernel/setup.c b/arch/nios2/kernel/setup.c
index a3fa80d1aacc..6e57ffa5db27 100644
--- a/arch/nios2/kernel/setup.c
+++ b/arch/nios2/kernel/setup.c
@@ -14,6 +14,7 @@
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/sched.h>
+#include <linux/sched/task.h>
#include <linux/console.h>
#include <linux/bootmem.h>
#include <linux/initrd.h>
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index fa20060ff7a5..dfc479df9634 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -10,6 +10,7 @@
#include <linux/smp.h>
#include <linux/export.h>
#include <linux/memblock.h>
+#include <linux/sched/task.h>

#include <asm/lppaca.h>
#include <asm/paca.h>
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c
index 3a952a4f7965..d4dbf08722d6 100644
--- a/arch/um/kernel/skas/process.c
+++ b/arch/um/kernel/skas/process.c
@@ -6,6 +6,7 @@
#include <linux/init.h>
#include <linux/sched/mm.h>
#include <linux/sched/task_stack.h>
+#include <linux/sched/task.h>

#include <as-layout.h>
#include <kern.h>
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index e8175a8aa22c..4b85acd4020c 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -11,7 +11,9 @@
#include <linux/string.h>
#include <linux/utsname.h>
#include <linux/sched.h>
+#include <linux/sched/task.h>
#include <linux/kmsg_dump.h>
+
#include <asm/pgtable.h>
#include <asm/processor.h>
#include <asm/sections.h>
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 79f25eca10eb..211ca8abde45 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -9,6 +9,7 @@
#include <linux/delay.h>
#include <linux/sched.h>
#include <linux/sched/clock.h>
+#include <linux/sched/task.h>
#include <linux/init.h>
#include <linux/kprobes.h>
#include <linux/kgdb.h>
diff --git a/arch/x86/mm/kasan_init_64.c b/arch/x86/mm/kasan_init_64.c
index 0493c17b8a51..8d63d7a104c3 100644
--- a/arch/x86/mm/kasan_init_64.c
+++ b/arch/x86/mm/kasan_init_64.c
@@ -4,6 +4,7 @@
#include <linux/kdebug.h>
#include <linux/mm.h>
#include <linux/sched.h>
+#include <linux/sched/task.h>
#include <linux/vmalloc.h>

#include <asm/tlbflush.h>
diff --git a/fs/namespace.c b/fs/namespace.c
index b2ea27d8312c..47b4b27ecb44 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -25,6 +25,8 @@
#include <linux/magic.h>
#include <linux/bootmem.h>
#include <linux/task_work.h>
+#include <linux/sched/task.h>
+
#include "pnode.h"
#include "internal.h"

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 1d4ea71c550a..4cd39052403b 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1459,9 +1459,6 @@ static inline int kstack_end(void *addr)
}
#endif

-extern union thread_union init_thread_union;
-extern struct task_struct init_task;
-
/*
* find a task by one of its numerical ids
*
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index cad4d6eea663..d2dff79d14da 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -4,6 +4,7 @@
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/sched/jobctl.h>
+#include <linux/sched/task.h>
#include <linux/cred.h>

/*
diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h
index 5cdb7ee3978b..5bc61717086a 100644
--- a/include/linux/sched/task.h
+++ b/include/linux/sched/task.h
@@ -3,13 +3,14 @@

#include <linux/spinlock.h>

-struct task_struct;
-
/*
* Interface between the scheduler and various task lifetime (fork()/exit())
* functionality:
*/

+struct task_struct;
+union thread_union;
+
/*
* This serializes "schedule()" and also protects
* the run-queue from deletions/modifications (but
@@ -19,6 +20,9 @@ struct task_struct;
extern rwlock_t tasklist_lock;
extern spinlock_t mmlist_lock;

+extern union thread_union init_thread_union;
+extern struct task_struct init_task;
+
#ifdef CONFIG_PROVE_RCU
extern int lockdep_tasklist_lock_is_held(void);
#endif /* #ifdef CONFIG_PROVE_RCU */
diff --git a/init/init_task.c b/init/init_task.c
index 53d4ce942a88..66787e30a419 100644
--- a/init/init_task.c
+++ b/init/init_task.c
@@ -4,6 +4,7 @@
#include <linux/sched.h>
#include <linux/sched/sysctl.h>
#include <linux/sched/rt.h>
+#include <linux/sched/task.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/mm.h>
diff --git a/kernel/delayacct.c b/kernel/delayacct.c
index 660549656991..c94135fc2698 100644
--- a/kernel/delayacct.c
+++ b/kernel/delayacct.c
@@ -14,6 +14,7 @@
*/

#include <linux/sched.h>
+#include <linux/sched/task.h>
#include <linux/slab.h>
#include <linux/taskstats.h>
#include <linux/time.h>
diff --git a/lib/is_single_threaded.c b/lib/is_single_threaded.c
index 8d4678edcc0e..9c7d89df40ed 100644
--- a/lib/is_single_threaded.c
+++ b/lib/is_single_threaded.c
@@ -10,6 +10,7 @@
* 2 of the Licence, or (at your option) any later version.
*/
#include <linux/sched/signal.h>
+#include <linux/sched/task.h>
#include <linux/sched/mm.h>

/*
diff --git a/mm/vmacache.c b/mm/vmacache.c
index 4355d34c68a6..7ffa0ee341b5 100644
--- a/mm/vmacache.c
+++ b/mm/vmacache.c
@@ -2,6 +2,7 @@
* Copyright (C) 2014 Davidlohr Bueso.
*/
#include <linux/sched/signal.h>
+#include <linux/sched/task.h>
#include <linux/mm.h>
#include <linux/vmacache.h>

--
2.7.4