diff options
| author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2011-10-25 04:00:11 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2011-11-17 06:20:19 -0500 |
| commit | 029632fbb7b7c9d85063cc9eb470de6c54873df3 (patch) | |
| tree | 511303f0fa32f997c4b2f68364b032555b6a642e | |
| parent | 60686317da05049385eae86e44c710cde535f95f (diff) | |
sched: Make separate sched*.c translation units
Since once needs to do something at conferences and fixing compile
warnings doesn't actually require much if any attention I decided
to break up the sched.c #include "*.c" fest.
This further modularizes the scheduler code.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-x0fcd3mnp8f9c99grcpewmhi@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
| -rw-r--r-- | include/linux/latencytop.h | 3 | ||||
| -rw-r--r-- | include/linux/sched.h | 9 | ||||
| -rw-r--r-- | kernel/Makefile | 10 | ||||
| -rw-r--r-- | kernel/sched.c | 1828 | ||||
| -rw-r--r-- | kernel/sched.h | 1064 | ||||
| -rw-r--r-- | kernel/sched_autogroup.c | 33 | ||||
| -rw-r--r-- | kernel/sched_autogroup.h | 26 | ||||
| -rw-r--r-- | kernel/sched_debug.c | 4 | ||||
| -rw-r--r-- | kernel/sched_fair.c | 580 | ||||
| -rw-r--r-- | kernel/sched_idletask.c | 4 | ||||
| -rw-r--r-- | kernel/sched_rt.c | 209 | ||||
| -rw-r--r-- | kernel/sched_stats.c | 111 | ||||
| -rw-r--r-- | kernel/sched_stats.h | 103 | ||||
| -rw-r--r-- | kernel/sched_stoptask.c | 4 |
14 files changed, 2034 insertions, 1954 deletions
diff --git a/include/linux/latencytop.h b/include/linux/latencytop.h index b0e99898527c..e23121f9d82a 100644 --- a/include/linux/latencytop.h +++ b/include/linux/latencytop.h | |||
| @@ -10,6 +10,8 @@ | |||
| 10 | #define _INCLUDE_GUARD_LATENCYTOP_H_ | 10 | #define _INCLUDE_GUARD_LATENCYTOP_H_ |
| 11 | 11 | ||
| 12 | #include <linux/compiler.h> | 12 | #include <linux/compiler.h> |
| 13 | struct task_struct; | ||
| 14 | |||
| 13 | #ifdef CONFIG_LATENCYTOP | 15 | #ifdef CONFIG_LATENCYTOP |
| 14 | 16 | ||
| 15 | #define LT_SAVECOUNT 32 | 17 | #define LT_SAVECOUNT 32 |
| @@ -23,7 +25,6 @@ struct latency_record { | |||
| 23 | }; | 25 | }; |
| 24 | 26 | ||
| 25 | 27 | ||
| 26 | struct task_struct; | ||
| 27 | 28 | ||
| 28 | extern int latencytop_enabled; | 29 | extern int latencytop_enabled; |
| 29 | void __account_scheduler_latency(struct task_struct *task, int usecs, int inter); | 30 | void __account_scheduler_latency(struct task_struct *task, int usecs, int inter); |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 68daf4f27e2c..8db17b7622ec 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -925,6 +925,15 @@ static inline struct cpumask *sched_group_cpus(struct sched_group *sg) | |||
| 925 | return to_cpumask(sg->cpumask); | 925 | return to_cpumask(sg->cpumask); |
| 926 | } | 926 | } |
| 927 | 927 | ||
| 928 | /** | ||
| 929 | * group_first_cpu - Returns the first cpu in the cpumask of a sched_group. | ||
| 930 | * @group: The group whose first cpu is to be returned. | ||
| 931 | */ | ||
| 932 | static inline unsigned int group_first_cpu(struct sched_group *group) | ||
| 933 | { | ||
| 934 | return cpumask_first(sched_group_cpus(group)); | ||
| 935 | } | ||
| 936 | |||
| 928 | struct sched_domain_attr { | 937 | struct sched_domain_attr { |
| 929 | int relax_domain_level; | 938 | int relax_domain_level; |
| 930 | }; | 939 | }; |
diff --git a/kernel/Makefile b/kernel/Makefile index e898c5b9d02c..1a4d37d7f39a 100644 --- a/kernel/Makefile +++ b/kernel/Makefile | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | # Makefile for the linux kernel. | 2 | # Makefile for the linux kernel. |
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | obj-y = sched.o fork.o exec_domain.o panic.o printk.o \ | 5 | obj-y = fork.o exec_domain.o panic.o printk.o \ |
| 6 | cpu.o exit.o itimer.o time.o softirq.o resource.o \ | 6 | cpu.o exit.o itimer.o time.o softirq.o resource.o \ |
| 7 | sysctl.o sysctl_binary.o capability.o ptrace.o timer.o user.o \ | 7 | sysctl.o sysctl_binary.o capability.o ptrace.o timer.o user.o \ |
| 8 | signal.o sys.o kmod.o workqueue.o pid.o \ | 8 | signal.o sys.o kmod.o workqueue.o pid.o \ |
| @@ -10,8 +10,12 @@ obj-y = sched.o fork.o exec_domain.o panic.o printk.o \ | |||
| 10 | kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \ | 10 | kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \ |
| 11 | hrtimer.o rwsem.o nsproxy.o srcu.o semaphore.o \ | 11 | hrtimer.o rwsem.o nsproxy.o srcu.o semaphore.o \ |
| 12 | notifier.o ksysfs.o sched_clock.o cred.o \ | 12 | notifier.o ksysfs.o sched_clock.o cred.o \ |
| 13 | async.o range.o | 13 | async.o range.o groups.o |
| 14 | obj-y += groups.o | 14 | |
| 15 | obj-y += sched.o sched_idletask.o sched_fair.o sched_rt.o sched_stoptask.o | ||
| 16 | obj-$(CONFIG_SCHED_AUTOGROUP) += sched_autogroup.o | ||
| 17 | obj-$(CONFIG_SCHEDSTATS) += sched_stats.o | ||
| 18 | obj-$(CONFIG_SCHED_DEBUG) += sched_debug.o | ||
| 15 | 19 | ||
| 16 | ifdef CONFIG_FUNCTION_TRACER | 20 | ifdef CONFIG_FUNCTION_TRACER |
| 17 | # Do not trace debug files and internal ftrace files | 21 | # Do not trace debug files and internal ftrace files |
diff --git a/kernel/sched.c b/kernel/sched.c index c9e3ab6e299e..2ffcceed8862 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
| @@ -56,7 +56,6 @@ | |||
| 56 | #include <linux/percpu.h> | 56 | #include <linux/percpu.h> |
| 57 | #include <linux/proc_fs.h> | 57 | #include <linux/proc_fs.h> |
| 58 | #include <linux/seq_file.h> | 58 | #include <linux/seq_file.h> |
| 59 | #include <linux/stop_machine.h> | ||
| 60 | #include <linux/sysctl.h> | 59 | #include <linux/sysctl.h> |
| 61 | #include <linux/syscalls.h> | 60 | #include <linux/syscalls.h> |
| 62 | #include <linux/times.h> | 61 | #include <linux/times.h> |
| @@ -72,133 +71,20 @@ | |||
| 72 | #include <linux/ftrace.h> | 71 | #include <linux/ftrace.h> |
| 73 | #include <linux/slab.h> | 72 | #include <linux/slab.h> |
| 74 | #include <linux/init_task.h> | 73 | #include <linux/init_task.h> |
| 75 | #include <linux/jump_label.h> | ||
| 76 | 74 | ||
| 77 | #include <asm/tlb.h> | 75 | #include <asm/tlb.h> |
| 78 | #include <asm/irq_regs.h> | 76 | #include <asm/irq_regs.h> |
| 79 | #include <asm/mutex.h> | ||
| 80 | #ifdef CONFIG_PARAVIRT | 77 | #ifdef CONFIG_PARAVIRT |
| 81 | #include <asm/paravirt.h> | 78 | #include <asm/paravirt.h> |
| 82 | #endif | 79 | #endif |
| 83 | 80 | ||
| 84 | #include "sched_cpupri.h" | 81 | #include "sched.h" |
| 85 | #include "workqueue_sched.h" | 82 | #include "workqueue_sched.h" |
| 86 | #include "sched_autogroup.h" | ||
| 87 | 83 | ||
| 88 | #define CREATE_TRACE_POINTS | 84 | #define CREATE_TRACE_POINTS |
| 89 | #include <trace/events/sched.h> | 85 | #include <trace/events/sched.h> |
| 90 | 86 | ||
| 91 | /* | 87 | void start_bandwidth_timer(struct hrtimer *period_timer, ktime_t period) |
| 92 | * Convert user-nice values [ -20 ... 0 ... 19 ] | ||
| 93 | * to static priority [ MAX_RT_PRIO..MAX_PRIO-1 ], | ||
| 94 | * and back. | ||
| 95 | */ | ||
| 96 | #define NICE_TO_PRIO(nice) (MAX_RT_PRIO + (nice) + 20) | ||
| 97 | #define PRIO_TO_NICE(prio) ((prio) - MAX_RT_PRIO - 20) | ||
| 98 | #define TASK_NICE(p) PRIO_TO_NICE((p)->static_prio) | ||
| 99 | |||
| 100 | /* | ||
| 101 | * 'User priority' is the nice value converted to something we | ||
| 102 | * can work with better when scaling various scheduler parameters, | ||
| 103 | * it's a [ 0 ... 39 ] range. | ||
| 104 | */ | ||
| 105 | #define USER_PRIO(p) ((p)-MAX_RT_PRIO) | ||
| 106 | #define TASK_USER_PRIO(p) USER_PRIO((p)->static_prio) | ||
| 107 | #define MAX_USER_PRIO (USER_PRIO(MAX_PRIO)) | ||
| 108 | |||
| 109 | /* | ||
| 110 | * Helpers for converting nanosecond timing to jiffy resolution | ||
| 111 | */ | ||
| 112 | #define NS_TO_JIFFIES(TIME) ((unsigned long)(TIME) / (NSEC_PER_SEC / HZ)) | ||
| 113 | |||
| 114 | #define NICE_0_LOAD SCHED_LOAD_SCALE | ||
| 115 | #define NICE_0_SHIFT SCHED_LOAD_SHIFT | ||
| 116 | |||
| 117 | /* | ||
| 118 | * These are the 'tuning knobs' of the scheduler: | ||
| 119 | * | ||
| 120 | * default timeslice is 100 msecs (used only for SCHED_RR tasks). | ||
| 121 | * Timeslices get refilled after they expire. | ||
| 122 | */ | ||
| 123 | #define DEF_TIMESLICE (100 * HZ / 1000) | ||
| 124 | |||
| 125 | /* | ||
| 126 | * single value that denotes runtime == period, ie unlimited time. | ||
| 127 | */ | ||
| 128 | #define RUNTIME_INF ((u64)~0ULL) | ||
| 129 | |||
| 130 | static inline int rt_policy(int policy) | ||
| 131 | { | ||
| 132 | if (policy == SCHED_FIFO || policy == SCHED_RR) | ||
| 133 | return 1; | ||
| 134 | return 0; | ||
| 135 | } | ||
| 136 | |||
| 137 | static inline int task_has_rt_policy(struct task_struct *p) | ||
| 138 | { | ||
| 139 | return rt_policy(p->policy); | ||
| 140 | } | ||
| 141 | |||
| 142 | /* | ||
| 143 | * This is the priority-queue data structure of the RT scheduling class: | ||
| 144 | */ | ||
| 145 | struct rt_prio_array { | ||
| 146 | DECLARE_BITMAP(bitmap, MAX_RT_PRIO+1); /* include 1 bit for delimiter */ | ||
| 147 | struct list_head queue[MAX_RT_PRIO]; | ||
| 148 | }; | ||
| 149 | |||
| 150 | struct rt_bandwidth { | ||
| 151 | /* nests inside the rq lock: */ | ||
| 152 | raw_spinlock_t rt_runtime_lock; | ||
| 153 | ktime_t rt_period; | ||
| 154 | u64 rt_runtime; | ||
| 155 | struct hrtimer rt_period_timer; | ||
| 156 | }; | ||
| 157 | |||
| 158 | static struct rt_bandwidth def_rt_bandwidth; | ||
| 159 | |||
| 160 | static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun); | ||
