diff options
author | Ingo Molnar <mingo@kernel.org> | 2018-03-03 06:20:47 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2018-03-04 06:39:29 -0500 |
commit | 325ea10c0809406ce23f038602abbc454f3f761d (patch) | |
tree | 4a3f7e57a7d2aecd05c9b9e1e610d52e5050a817 | |
parent | 97fb7a0a8944bd6d2c5634e1e0fa689a5c40bc22 (diff) |
sched/headers: Simplify and clean up header usage in the scheduler
Do the following cleanups and simplifications:
- sched/sched.h already includes <asm/paravirt.h>, so no need to
include it in sched/core.c again.
- order the <linux/sched/*.h> headers alphabetically
- add all <linux/sched/*.h> headers to kernel/sched/sched.h
- remove all unnecessary includes from the .c files that
are already included in kernel/sched/sched.h.
Finally, make all scheduler .c files use a single common header:
#include "sched.h"
... which now contains a union of the relied upon headers.
This makes the various .c files easier to read and easier to handle.
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
29 files changed, 94 insertions, 219 deletions
diff --git a/include/linux/sched/deadline.h b/include/linux/sched/deadline.h index a5bc8728ead7..0cb034331cbb 100644 --- a/include/linux/sched/deadline.h +++ b/include/linux/sched/deadline.h | |||
@@ -1,8 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | #ifndef _LINUX_SCHED_DEADLINE_H | ||
3 | #define _LINUX_SCHED_DEADLINE_H | ||
4 | |||
5 | #include <linux/sched.h> | ||
6 | 2 | ||
7 | /* | 3 | /* |
8 | * SCHED_DEADLINE tasks has negative priorities, reflecting | 4 | * SCHED_DEADLINE tasks has negative priorities, reflecting |
@@ -28,5 +24,3 @@ static inline bool dl_time_before(u64 a, u64 b) | |||
28 | { | 24 | { |
29 | return (s64)(a - b) < 0; | 25 | return (s64)(a - b) < 0; |
30 | } | 26 | } |
31 | |||
32 | #endif /* _LINUX_SCHED_DEADLINE_H */ | ||
diff --git a/kernel/sched/autogroup.c b/kernel/sched/autogroup.c index ff1b7b647b86..6be6c575b6cd 100644 --- a/kernel/sched/autogroup.c +++ b/kernel/sched/autogroup.c | |||
@@ -1,10 +1,7 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2 | #include <linux/proc_fs.h> | 2 | /* |
3 | #include <linux/seq_file.h> | 3 | * Auto-group scheduling implementation: |
4 | #include <linux/utsname.h> | 4 | */ |
5 | #include <linux/security.h> | ||
6 | #include <linux/export.h> | ||
7 | |||
8 | #include "sched.h" | 5 | #include "sched.h" |
9 | 6 | ||
10 | unsigned int __read_mostly sysctl_sched_autogroup_enabled = 1; | 7 | unsigned int __read_mostly sysctl_sched_autogroup_enabled = 1; |
diff --git a/kernel/sched/autogroup.h b/kernel/sched/autogroup.h index 49e6ec9559cf..b96419974a1f 100644 --- a/kernel/sched/autogroup.h +++ b/kernel/sched/autogroup.h | |||
@@ -1,10 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | #ifdef CONFIG_SCHED_AUTOGROUP | 2 | #ifdef CONFIG_SCHED_AUTOGROUP |
3 | 3 | ||
4 | #include <linux/kref.h> | ||
5 | #include <linux/rwsem.h> | ||
6 | #include <linux/sched/autogroup.h> | ||
7 | |||
8 | struct autogroup { | 4 | struct autogroup { |
9 | /* | 5 | /* |
10 | * Reference doesn't mean how many threads attach to this | 6 | * Reference doesn't mean how many threads attach to this |
diff --git a/kernel/sched/clock.c b/kernel/sched/clock.c index 7da6bec8a2ff..10c83e73837a 100644 --- a/kernel/sched/clock.c +++ b/kernel/sched/clock.c | |||
@@ -52,19 +52,7 @@ | |||
52 | * that is otherwise invisible (TSC gets stopped). | 52 | * that is otherwise invisible (TSC gets stopped). |
53 | * | 53 | * |
54 | */ | 54 | */ |
55 | #include <linux/spinlock.h> | 55 | #include "sched.h" |
56 | #include <linux/hardirq.h> | ||
57 | #include <linux/export.h> | ||
58 | #include <linux/percpu.h> | ||
59 | #include <linux/ktime.h> | ||
60 | #include <linux/sched.h> | ||
61 | #include <linux/nmi.h> | ||
62 | #include <linux/sched/clock.h> | ||
63 | #include <linux/static_key.h> | ||
64 | #include <linux/workqueue.h> | ||
65 | #include <linux/compiler.h> | ||
66 | #include <linux/tick.h> | ||
67 | #include <linux/init.h> | ||
68 | 56 | ||
69 | /* | 57 | /* |
70 | * Scheduler clock - returns current time in nanosec units. | 58 | * Scheduler clock - returns current time in nanosec units. |
diff --git a/kernel/sched/completion.c b/kernel/sched/completion.c index 0926aef10dad..5d2d56b0817a 100644 --- a/kernel/sched/completion.c +++ b/kernel/sched/completion.c | |||
@@ -11,10 +11,7 @@ | |||
11 | * typically be used for exclusion which gives rise to priority inversion. | 11 | * typically be used for exclusion which gives rise to priority inversion. |
12 | * Waiting for completion is a typically sync point, but not an exclusion point. | 12 | * Waiting for completion is a typically sync point, but not an exclusion point. |
13 | */ | 13 | */ |
14 | 14 | #include "sched.h" | |
15 | #include <linux/sched/signal.h> | ||
16 | #include <linux/sched/debug.h> | ||
17 | #include <linux/completion.h> | ||
18 | 15 | ||
19 | /** | 16 | /** |
20 | * complete: - signals a single thread waiting on this completion | 17 | * complete: - signals a single thread waiting on this completion |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 9427b59551c1..e1e334ba8ff9 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -5,37 +5,11 @@ | |||
5 | * | 5 | * |
6 | * Copyright (C) 1991-2002 Linus Torvalds | 6 | * Copyright (C) 1991-2002 Linus Torvalds |
7 | */ | 7 | */ |
8 | #include <linux/sched.h> | 8 | #include "sched.h" |
9 | #include <linux/sched/clock.h> | ||
10 | #include <uapi/linux/sched/types.h> | ||
11 | #include <linux/sched/loadavg.h> | ||
12 | #include <linux/sched/hotplug.h> | ||
13 | #include <linux/wait_bit.h> | ||
14 | #include <linux/cpuset.h> | ||
15 | #include <linux/delayacct.h> | ||
16 | #include <linux/init_task.h> | ||
17 | #include <linux/context_tracking.h> | ||
18 | #include <linux/rcupdate_wait.h> | ||
19 | #include <linux/compat.h> | ||
20 | |||
21 | #include <linux/blkdev.h> | ||
22 | #include <linux/kprobes.h> | ||
23 | #include <linux/mmu_context.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/nmi.h> | ||
26 | #include <linux/prefetch.h> | ||
27 | #include <linux/profile.h> | ||
28 | #include <linux/security.h> | ||
29 | #include <linux/syscalls.h> | ||
30 | #include <linux/sched/isolation.h> | ||
31 | 9 | ||
32 | #include <asm/switch_to.h> | 10 | #include <asm/switch_to.h> |
33 | #include <asm/tlb.h> | 11 | #include <asm/tlb.h> |
34 | #ifdef CONFIG_PARAVIRT | ||
35 | #include <asm/paravirt.h> | ||
36 | #endif | ||
37 | 12 | ||
38 | #include "sched.h" | ||
39 | #include "../workqueue_internal.h" | 13 | #include "../workqueue_internal.h" |
40 | #include "../smpboot.h" | 14 | #include "../smpboot.h" |
41 | 15 | ||
@@ -2629,6 +2603,18 @@ static inline void finish_lock_switch(struct rq *rq) | |||
2629 | raw_spin_unlock_irq(&rq->lock); | 2603 | raw_spin_unlock_irq(&rq->lock); |
2630 | } | 2604 | } |
2631 | 2605 | ||
2606 | /* | ||
2607 | * NOP if the arch has not defined these: | ||
2608 | */ | ||
2609 | |||
2610 | #ifndef prepare_arch_switch | ||
2611 | # define prepare_arch_switch(next) do { } while (0) | ||
2612 | #endif | ||
2613 | |||
2614 | #ifndef finish_arch_post_lock_switch | ||
2615 | # define finish_arch_post_lock_switch() do { } while (0) | ||
2616 | #endif | ||
2617 | |||
2632 | /** | 2618 | /** |
2633 | * prepare_task_switch - prepare to switch tasks | 2619 | * prepare_task_switch - prepare to switch tasks |
2634 | * @rq: the runqueue preparing to switch | 2620 | * @rq: the runqueue preparing to switch |
diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c index 1abd325e733a..9fbb10383434 100644 --- a/kernel/sched/cpuacct.c +++ b/kernel/sched/cpuacct.c | |||
@@ -1,22 +1,11 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2 | #include <linux/cgroup.h> | ||
3 | #include <linux/slab.h> | ||
4 | #include <linux/percpu.h> | ||
5 | #include <linux/spinlock.h> | ||
6 | #include <linux/cpumask.h> | ||
7 | #include <linux/seq_file.h> | ||
8 | #include <linux/rcupdate.h> | ||
9 | #include <linux/kernel_stat.h> | ||
10 | #include <linux/err.h> | ||
11 | |||
12 | #include "sched.h" | ||
13 | |||
14 | /* | 2 | /* |
15 | * CPU accounting code for task groups. | 3 | * CPU accounting code for task groups. |
16 | * | 4 | * |
17 | * Based on the work by Paul Menage (menage@google.com) and Balbir Singh | 5 | * Based on the work by Paul Menage (menage@google.com) and Balbir Singh |
18 | * (balbir@in.ibm.com). | 6 | * (balbir@in.ibm.com). |
19 | */ | 7 | */ |
8 | #include "sched.h" | ||
20 | 9 | ||
21 | /* Time spent by the tasks of the CPU accounting group executing in ... */ | 10 | /* Time spent by the tasks of the CPU accounting group executing in ... */ |
22 | enum cpuacct_stat_index { | 11 | enum cpuacct_stat_index { |
diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c index cb172b61d191..50316455ea66 100644 --- a/kernel/sched/cpudeadline.c +++ b/kernel/sched/cpudeadline.c | |||
@@ -10,10 +10,7 @@ | |||
10 | * as published by the Free Software Foundation; version 2 | 10 | * as published by the Free Software Foundation; version 2 |
11 | * of the License. | 11 | * of the License. |
12 | */ | 12 | */ |
13 | #include <linux/gfp.h> | 13 | #include "sched.h" |
14 | #include <linux/kernel.h> | ||
15 | #include <linux/slab.h> | ||
16 | #include "cpudeadline.h" | ||
17 | 14 | ||
18 | static inline int parent(int i) | 15 | static inline int parent(int i) |
19 | { | 16 | { |
diff --git a/kernel/sched/cpudeadline.h b/kernel/sched/cpudeadline.h index c26e7a0e5a66..0adeda93b5fb 100644 --- a/kernel/sched/cpudeadline.h +++ b/kernel/sched/cpudeadline.h | |||
@@ -1,6 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | #include <linux/sched.h> | ||
3 | #include <linux/sched/deadline.h> | ||
4 | 2 | ||
5 | #define IDX_INVALID -1 | 3 | #define IDX_INVALID -1 |
6 | 4 | ||
diff --git a/kernel/sched/cpufreq.c b/kernel/sched/cpufreq.c index dbc51442ecbc..5e54cbcae673 100644 --- a/kernel/sched/cpufreq.c +++ b/kernel/sched/cpufreq.c | |||
@@ -8,7 +8,6 @@ | |||
8 | * it under the terms of the GNU General Public License version 2 as | 8 | * it under the terms of the GNU General Public License version 2 as |
9 | * published by the Free Software Foundation. | 9 | * published by the Free Software Foundation. |
10 | */ | 10 | */ |
11 | |||
12 | #include "sched.h" | 11 | #include "sched.h" |
13 | 12 | ||
14 | DEFINE_PER_CPU(struct update_util_data *, cpufreq_update_util_data); | 13 | DEFINE_PER_CPU(struct update_util_data *, cpufreq_update_util_data); |
diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 0dad8160e00f..feb5f89020f2 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c | |||
@@ -11,14 +11,10 @@ | |||
11 | 11 | ||
12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
13 | 13 | ||
14 | #include <linux/cpufreq.h> | ||
15 | #include <linux/kthread.h> | ||
16 | #include <uapi/linux/sched/types.h> | ||
17 | #include <linux/slab.h> | ||
18 | #include <trace/events/power.h> | ||
19 | |||
20 | #include "sched.h" | 14 | #include "sched.h" |
21 | 15 | ||
16 | #include <trace/events/power.h> | ||
17 | |||
22 | struct sugov_tunables { | 18 | struct sugov_tunables { |
23 | struct gov_attr_set attr_set; | 19 | struct gov_attr_set attr_set; |
24 | unsigned int rate_limit_us; | 20 | unsigned int rate_limit_us; |
diff --git a/kernel/sched/cpupri.c b/kernel/sched/cpupri.c index f43e14ccb67d..daaadf939ccb 100644 --- a/kernel/sched/cpupri.c +++ b/kernel/sched/cpupri.c | |||
@@ -26,11 +26,7 @@ | |||
26 | * as published by the Free Software Foundation; version 2 | 26 | * as published by the Free Software Foundation; version 2 |
27 | * of the License. | 27 | * of the License. |
28 | */ | 28 | */ |
29 | #include <linux/gfp.h> | 29 | #include "sched.h" |
30 | #include <linux/sched.h> | ||
31 | #include <linux/sched/rt.h> | ||
32 | #include <linux/slab.h> | ||
33 | #include "cpupri.h" | ||
34 | 30 | ||
35 | /* Convert between a 140 based task->prio, and our 102 based cpupri */ | 31 | /* Convert between a 140 based task->prio, and our 102 based cpupri */ |
36 | static int convert_prio(int prio) | 32 | static int convert_prio(int prio) |
diff --git a/kernel/sched/cpupri.h b/kernel/sched/cpupri.h index 141a06c914c6..7dc20a3232e7 100644 --- a/kernel/sched/cpupri.h +++ b/kernel/sched/cpupri.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | #include <linux/sched.h> | ||
3 | 2 | ||
4 | #define CPUPRI_NR_PRIORITIES (MAX_RT_PRIO + 2) | 3 | #define CPUPRI_NR_PRIORITIES (MAX_RT_PRIO + 2) |
5 | 4 | ||
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index d3b450b57ade..0796f938c4f0 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c | |||
@@ -1,10 +1,6 @@ | |||
1 | #include <linux/export.h> | 1 | /* |
2 | #include <linux/sched.h> | 2 | * Simple CPU accounting cgroup controller |
3 | #include <linux/tsacct_kern.h> | 3 | */ |
4 | #include <linux/kernel_stat.h> | ||
5 | #include <linux/static_key.h> | ||
6 | #include <linux/context_tracking.h> | ||
7 | #include <linux/sched/cputime.h> | ||
8 | #include "sched.h" | 4 | #include "sched.h" |
9 | 5 | ||
10 | #ifdef CONFIG_IRQ_TIME_ACCOUNTING | 6 | #ifdef CONFIG_IRQ_TIME_ACCOUNTING |
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 58f8b7b37983..af491f537636 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c | |||
@@ -17,9 +17,6 @@ | |||
17 | */ | 17 | */ |
18 | #include "sched.h" | 18 | #include "sched.h" |
19 | 19 | ||
20 | #include <linux/slab.h> | ||
21 | #include <uapi/linux/sched/types.h> | ||
22 | |||
23 | struct dl_bandwidth def_dl_bandwidth; | 20 | struct dl_bandwidth def_dl_bandwidth; |
24 | 21 | ||
25 | static inline struct task_struct *dl_task_of(struct sched_dl_entity *dl_se) | 22 | static inline struct task_struct *dl_task_of(struct sched_dl_entity *dl_se) |
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 7c82a9b88510..644d9a464380 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * kernel/sched/debug.c | 2 | * kernel/sched/debug.c |
3 | * | 3 | * |
4 | * Print the CFS rbtree | 4 | * Print the CFS rbtree and other debugging details |
5 | * | 5 | * |
6 | * Copyright(C) 2007, Red Hat, Inc., Ingo Molnar | 6 | * Copyright(C) 2007, Red Hat, Inc., Ingo Molnar |
7 | * | 7 | * |
@@ -9,15 +9,6 @@ | |||
9 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
11 | */ | 11 | */ |
12 | #include <linux/proc_fs.h> | ||
13 | #include <linux/sched/mm.h> | ||
14 | #include <linux/sched/task.h> | ||
15 | #include <linux/seq_file.h> | ||
16 | #include <linux/kallsyms.h> | ||
17 | #include <linux/utsname.h> | ||
18 | #include <linux/mempolicy.h> | ||
19 | #include <linux/debugfs.h> | ||
20 | |||
21 | #include "sched.h" | 12 | #include "sched.h" |
22 | 13 | ||
23 | static DEFINE_SPINLOCK(sched_debug_lock); | 14 | static DEFINE_SPINLOCK(sched_debug_lock); |
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 1f877de96c9b..f5591071ae98 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -20,24 +20,10 @@ | |||
20 | * Adaptive scheduling granularity, math enhancements by Peter Zijlstra | 20 | * Adaptive scheduling granularity, math enhancements by Peter Zijlstra |
21 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra | 21 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra |
22 | */ | 22 | */ |
23 | #include <linux/sched/mm.h> | 23 | #include "sched.h" |
24 | #include <linux/sched/topology.h> | ||
25 | |||
26 | #include <linux/latencytop.h> | ||
27 | #include <linux/cpumask.h> | ||
28 | #include <linux/cpuidle.h> | ||
29 | #include <linux/slab.h> | ||
30 | #include <linux/profile.h> | ||
31 | #include <linux/interrupt.h> | ||
32 | #include <linux/mempolicy.h> | ||
33 | #include <linux/migrate.h> | ||
34 | #include <linux/task_work.h> | ||
35 | #include <linux/sched/isolation.h> | ||
36 | 24 | ||
37 | #include <trace/events/sched.h> | 25 | #include <trace/events/sched.h> |
38 | 26 | ||
39 | #include "sched.h" | ||
40 | |||
41 | /* | 27 | /* |
42 | * Targeted preemption latency for CPU-bound tasks: | 28 | * Targeted preemption latency for CPU-bound tasks: |
43 | * | 29 | * |
diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index 343d25f85477..2760e0357271 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c | |||
@@ -1,23 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | * Generic entry points for the idle threads | 2 | * Generic entry points for the idle threads |
3 | */ | 3 | */ |
4 | #include <linux/sched.h> | 4 | #include "sched.h" |
5 | #include <linux/sched/idle.h> | ||
6 | #include <linux/cpu.h> | ||
7 | #include <linux/cpuidle.h> | ||
8 | #include <linux/cpuhotplug.h> | ||
9 | #include <linux/tick.h> | ||
10 | #include <linux/mm.h> | ||
11 | #include <linux/stackprotector.h> | ||
12 | #include <linux/suspend.h> | ||
13 | #include <linux/livepatch.h> | ||
14 | |||
15 | #include <asm/tlb.h> | ||
16 | 5 | ||
17 | #include <trace/events/power.h> | 6 | #include <trace/events/power.h> |
18 | 7 | ||
19 | #include "sched.h" | ||
20 | |||
21 | /* Linker adds these: start and end of __cpuidle functions */ | 8 | /* Linker adds these: start and end of __cpuidle functions */ |
22 | extern char __cpuidle_text_start[], __cpuidle_text_end[]; | 9 | extern char __cpuidle_text_start[], __cpuidle_text_end[]; |
23 | 10 | ||
diff --git a/kernel/sched/idle_task.c b/kernel/sched/idle_task.c index ec73680922f8..488222ac4651 100644 --- a/kernel/sched/idle_task.c +++ b/kernel/sched/idle_task.c | |||
@@ -1,12 +1,11 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2 | #include "sched.h" | ||
3 | |||
4 | /* | 2 | /* |
5 | * idle-task scheduling class. | 3 | * idle-task scheduling class. |
6 | * | 4 | * |
7 | * (NOTE: these are not related to SCHED_IDLE tasks which are | 5 | * (NOTE: these are not related to SCHED_IDLE batch scheduling tasks which are |
8 | * handled in sched/fair.c) | 6 | * handled in sched/fair.c) |
9 | */ | 7 | */ |
8 | #include "sched.h" | ||
10 | 9 | ||
11 | #ifdef CONFIG_SMP | 10 | #ifdef CONFIG_SMP |
12 | static int | 11 | static int |
diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c index aad5f48a07c6..e6802181900f 100644 --- a/kernel/sched/isolation.c +++ b/kernel/sched/isolation.c | |||
@@ -6,13 +6,6 @@ | |||
6 | * Copyright (C) 2017-2018 SUSE, Frederic Weisbecker | 6 | * Copyright (C) 2017-2018 SUSE, Frederic Weisbecker |
7 | * | 7 | * |
8 | */ | 8 | */ |
9 | #include <linux/sched/isolation.h> | ||
10 | #include <linux/tick.h> | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/static_key.h> | ||
14 | #include <linux/ctype.h> | ||
15 | |||
16 | #include "sched.h" | 9 | #include "sched.h" |
17 | 10 | ||
18 | DEFINE_STATIC_KEY_FALSE(housekeeping_overriden); | 11 | DEFINE_STATIC_KEY_FALSE(housekeeping_overriden); |
diff --git a/kernel/sched/loadavg.c b/kernel/sched/loadavg.c index a398e7e28a8a..a171c1258109 100644 --- a/kernel/sched/loadavg.c +++ b/kernel/sched/loadavg.c | |||
@@ -6,10 +6,6 @@ | |||
6 | * figure. Its a silly number but people think its important. We go through | 6 | * figure. Its a silly number but people think its important. We go through |
7 | * great pains to make it work on big machines and tickless kernels. | 7 | * great pains to make it work on big machines and tickless kernels. |
8 | */ | 8 | */ |
9 | |||
10 | #include <linux/export.h> | ||
11 | #include <linux/sched/loadavg.h> | ||
12 | |||
13 | #include "sched.h" | 9 | #include "sched.h" |
14 | 10 | ||
15 | /* | 11 | /* |
diff --git a/kernel/sched/membarrier.c b/kernel/sched/membarrier.c index 2c6ae2413fa2..76e0eaf4654e 100644 --- a/kernel/sched/membarrier.c +++ b/kernel/sched/membarrier.c | |||
@@ -13,14 +13,7 @@ | |||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * GNU General Public License for more details. | 14 | * GNU General Public License for more details. |
15 | */ | 15 | */ |
16 | 16 | #include "sched.h" | |
17 | #include <linux/syscalls.h> | ||
18 | #include <linux/membarrier.h> | ||
19 | #include <linux/tick.h> | ||
20 | #include <linux/cpumask.h> | ||
21 | #include <linux/atomic.h> | ||
22 | |||
23 | #include "sched.h" /* for cpu_rq(). */ | ||
24 | 17 | ||
25 | /* | 18 | /* |
26 | * Bitmask made from a "or" of all commands within enum membarrier_cmd, | 19 | * Bitmask made from a "or" of all commands within enum membarrier_cmd, |
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index e40498872111..a3d438fec46c 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c | |||
@@ -3,12 +3,8 @@ | |||
3 | * Real-Time Scheduling Class (mapped to the SCHED_FIFO and SCHED_RR | 3 | * Real-Time Scheduling Class (mapped to the SCHED_FIFO and SCHED_RR |
4 | * policies) | 4 | * policies) |
5 | */ | 5 | */ |
6 | |||
7 | #include "sched.h" | 6 | #include "sched.h" |
8 | 7 | ||
9 | #include <linux/slab.h> | ||
10 | #include <linux/irq_work.h> | ||
11 | |||
12 | int sched_rr_timeslice = RR_TIMESLICE; | 8 | int sched_rr_timeslice = RR_TIMESLICE; |
13 | int sysctl_sched_rr_timeslice = (MSEC_PER_SEC / HZ) * RR_TIMESLICE; | 9 | int sysctl_sched_rr_timeslice = (MSEC_PER_SEC / HZ) * RR_TIMESLICE; |
14 | 10 | ||
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index bd1461ae06e4..23ba4dd76ac4 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h | |||
@@ -3,39 +3,71 @@ | |||
3 | * Scheduler internal types and methods: | 3 | * Scheduler internal types and methods: |
4 | */ | 4 | */ |
5 | #include <linux/sched.h> | 5 | #include <linux/sched.h> |
6 | |||
6 | #include <linux/sched/autogroup.h> | 7 | #include <linux/sched/autogroup.h> |
7 | #include <linux/sched/sysctl.h> | ||
8 | #include <linux/sched/topology.h> | ||
9 | #include <linux/sched/rt.h> | ||
10 | #include <linux/sched/deadline.h> | ||
11 | #include <linux/sched/clock.h> | 8 | #include <linux/sched/clock.h> |
12 | #include <linux/sched/wake_q.h> | 9 | #include <linux/sched/coredump.h> |
13 | #include <linux/sched/signal.h> | ||
14 | #include <linux/sched/numa_balancing.h> | ||
15 | #include <linux/sched/mm.h> | ||
16 | #include <linux/sched/cpufreq.h> | 10 | #include <linux/sched/cpufreq.h> |
17 | #include <linux/sched/stat.h> | 11 | #include <linux/sched/cputime.h> |
18 | #include <linux/sched/nohz.h> | 12 | #include <linux/sched/deadline.h> |
19 | #include <linux/sched/debug.h> | 13 | #include <linux/sched/debug.h> |
20 | #include <linux/sched/hotplug.h> | 14 | #include <linux/sched/hotplug.h> |
15 | #include <linux/sched/idle.h> | ||
16 | #include <linux/sched/init.h> | ||
17 | #include <linux/sched/isolation.h> | ||
18 | #include <linux/sched/jobctl.h> | ||
19 | #include <linux/sched/loadavg.h> | ||
20 | #include <linux/sched/mm.h> | ||
21 | #include <linux/sched/nohz.h> | ||
22 | #include <linux/sched/numa_balancing.h> | ||
23 | #include <linux/sched/prio.h> | ||
24 | #include <linux/sched/rt.h> | ||
25 | #include <linux/sched/signal.h> | ||
26 | #include <linux/sched/stat.h> | ||
27 | #include <linux/sched/sysctl.h> | ||
21 | #include <linux/sched/task.h> | 28 | #include <linux/sched/task.h> |
22 | #include <linux/sched/task_stack.h> | 29 | #include <linux/sched/task_stack.h> |
23 | #include <linux/sched/cputime.h> | 30 | #include <linux/sched/topology.h> |
24 | #include <linux/sched/init.h> | 31 | #include <linux/sched/user.h> |
32 | #include <linux/sched/wake_q.h> | ||
33 | #include <linux/sched/xacct.h> | ||
34 | |||
35 | #include <uapi/linux/sched/types.h> | ||
25 | 36 | ||
26 | #include <linux/u64_stats_sync.h> | ||
27 | #include <linux/kernel_stat.h> | ||
28 | #include <linux/binfmts.h> | 37 | #include <linux/binfmts.h> |
29 | #include <linux/mutex.h> | 38 | #include <linux/blkdev.h> |
30 | #include <linux/spinlock.h> | 39 | #include <linux/compat.h> |
40 | #include <linux/context_tracking.h> | ||
41 | #include <linux/cpufreq.h> | ||
42 | #include <linux/cpuidle.h> | ||
43 | #include <linux/cpuset.h> | ||
44 | #include <linux/ctype.h> | ||
45 | #include <linux/debugfs.h> | ||
46 | #include <linux/delayacct.h> | ||
47 | #include <linux/init_task.h> | ||
48 | #include <linux/kprobes.h> | ||
49 | #include <linux/kthread.h> | ||
50 | #include <linux/membarrier.h> | ||
51 | #include <linux/migrate.h> | ||
52 | #include <linux/mmu_context.h> | ||
53 | #include <linux/nmi.h> | ||
54 | #include <linux/proc_fs.h> | ||
55 | #include <linux/prefetch.h> | ||
56 | #include <linux/profile.h> | ||
57 | #include <linux/rcupdate_wait.h> | ||
58 | #include <linux/security.h> | ||
59 | #include <linux/stackprotector.h> | ||
31 | #include <linux/stop_machine.h> | 60 | #include <linux/stop_machine.h> |
32 | #include <linux/irq_work.h> | 61 | #include <linux/suspend.h> |
33 | #include <linux/tick.h> | 62 | #include <linux/swait.h> |
34 | #include <linux/slab.h> | 63 | #include <linux/syscalls.h> |
35 | #include <linux/cgroup.h> | 64 | #include <linux/task_work.h> |
65 | #include <linux/tsacct_kern.h> | ||
66 | |||
67 | #include <asm/tlb.h> | ||
36 | 68 | ||
37 | #ifdef CONFIG_PARAVIRT | 69 | #ifdef CONFIG_PARAVIRT |
38 | #include <asm/paravirt.h> | 70 | # include <asm/paravirt.h> |
39 | #endif | 71 | #endif |
40 | 72 | ||
41 | #include "cpupri.h" | 73 | #include "cpupri.h" |
@@ -1357,13 +1389,6 @@ static inline int task_on_rq_migrating(struct task_struct *p) | |||
1357 | return p->on_rq == TASK_ON_RQ_MIGRATING; | 1389 | return p->on_rq == TASK_ON_RQ_MIGRATING; |
1358 | } | 1390 | } |
1359 | 1391 | ||
1360 | #ifndef prepare_arch_switch | ||
1361 | # define prepare_arch_switch(next) do { } while (0) | ||
1362 | #endif | ||
1363 | #ifndef finish_arch_post_lock_switch | ||
1364 | # define finish_arch_post_lock_switch() do { } while (0) | ||
1365 | #endif | ||
1366 | |||
1367 | /* | 1392 | /* |
1368 | * wake flags | 1393 | * wake flags |
1369 | */ | 1394 | */ |
diff --git a/kernel/sched/stats.c b/kernel/sched/stats.c index 968c1fe3099a..ab112cbfd7c8 100644 --- a/kernel/sched/stats.c +++ b/kernel/sched/stats.c | |||
@@ -1,14 +1,13 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2 | 2 | /* | |
3 | #include <linux/slab.h> | 3 | * /proc/schedstat implementation |
4 | #include <linux/fs.h> | 4 | */ |
5 | #include <linux/seq_file.h> | ||
6 | #include <linux/proc_fs.h> | ||
7 | |||
8 | #include "sched.h" | 5 | #include "sched.h" |
9 | 6 | ||
10 | /* | 7 | /* |
11 | * bump this up when changing the output format or the meaning of an existing | 8 | * Current schedstat API version. |
9 | * | ||
10 | * Bump this up when changing the output format or the meaning of an existing | ||
12 | * format, so that tools can adapt (or abort) | 11 | * format, so that tools can adapt (or abort) |
13 | */ | 12 | */ |
14 | #define SCHEDSTAT_VERSION 15 | 13 | #define SCHEDSTAT_VERSION 15 |
diff --git a/kernel/sched/swait.c b/kernel/sched/swait.c index b88ab4e0207f..b6fb2c3b3ff7 100644 --- a/kernel/sched/swait.c +++ b/kernel/sched/swait.c | |||
@@ -2,8 +2,7 @@ | |||
2 | /* | 2 | /* |
3 | * <linux/swait.h> (simple wait queues ) implementation: | 3 | * <linux/swait.h> (simple wait queues ) implementation: |
4 | */ | 4 | */ |
5 | #include <linux/sched/signal.h> | 5 | #include "sched.h" |
6 | #include <linux/swait.h> | ||
7 | 6 | ||
8 | void __init_swait_queue_head(struct swait_queue_head *q, const char *name, | 7 | void __init_swait_queue_head(struct swait_queue_head *q, const char *name, |
9 | struct lock_class_key *key) | 8 | struct lock_class_key *key) |
diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index 219eee70e457..64cc564f5255 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c | |||
@@ -2,10 +2,6 @@ | |||
2 | /* | 2 | /* |
3 | * Scheduler topology setup/handling methods | 3 | * Scheduler topology setup/handling methods |
4 | */ | 4 | */ |
5 | #include <linux/sched.h> | ||
6 | #include <linux/mutex.h> | ||
7 | #include <linux/sched/isolation.h> | ||
8 | |||
9 | #include "sched.h" | 5 | #include "sched.h" |
10 | 6 | ||
11 | DEFINE_MUTEX(sched_domains_mutex); | 7 | DEFINE_MUTEX(sched_domains_mutex); |
diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c index 7b2a142ae629..928be527477e 100644 --- a/kernel/sched/wait.c +++ b/kernel/sched/wait.c | |||
@@ -3,14 +3,7 @@ | |||
3 | * | 3 | * |
4 | * (C) 2004 Nadia Yvette Chambers, Oracle | 4 | * (C) 2004 Nadia Yvette Chambers, Oracle |
5 | */ | 5 | */ |
6 | #include <linux/init.h> | 6 | #include "sched.h" |
7 | #include <linux/export.h> | ||
8 | #include <linux/sched/signal.h> | ||
9 | #include <linux/sched/debug.h> | ||
10 | #include <linux/mm.h> | ||
11 | #include <linux/wait.h> | ||
12 | #include <linux/hash.h> | ||
13 | #include <linux/kthread.h> | ||
14 | 7 | ||
15 | void __init_waitqueue_head(struct wait_queue_head *wq_head, const char *name, struct lock_class_key *key) | 8 | void __init_waitqueue_head(struct wait_queue_head *wq_head, const char *name, struct lock_class_key *key) |
16 | { | 9 | { |
diff --git a/kernel/sched/wait_bit.c b/kernel/sched/wait_bit.c index 5293c59163a6..4239c78f5cd3 100644 --- a/kernel/sched/wait_bit.c +++ b/kernel/sched/wait_bit.c | |||
@@ -1,10 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * The implementation of the wait_bit*() and related waiting APIs: | 2 | * The implementation of the wait_bit*() and related waiting APIs: |
3 | */ | 3 | */ |
4 | #include <linux/wait_bit.h> | 4 | #include "sched.h" |
5 | #include <linux/sched/signal.h> | ||
6 | #include <linux/sched/debug.h> | ||
7 | #include <linux/hash.h> | ||
8 | 5 | ||
9 | #define WAIT_TABLE_BITS 8 | 6 | #define WAIT_TABLE_BITS 8 |
10 | #define WAIT_TABLE_SIZE (1 << WAIT_TABLE_BITS) | 7 | #define WAIT_TABLE_SIZE (1 << WAIT_TABLE_BITS) |