diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-14 22:14:06 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-14 22:14:06 -0400 |
| commit | d4e796152a049f6a675f8b6dcf7080a9d80014e5 (patch) | |
| tree | 3d7bff1541b4035f7fd06c7259032e616ea6b497 /include/linux | |
| parent | d88bfe1d68735595d57bd071294f664c4f054435 (diff) | |
| parent | f9c904b7613b8b4c85b10cd6b33ad41b2843fa9d (diff) | |
Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull scheduler updates from Ingo Molnar:
"The main changes in this cycle are:
- Make schedstats a runtime tunable (disabled by default) and
optimize it via static keys.
As most distributions enable CONFIG_SCHEDSTATS=y due to its
instrumentation value, this is a nice performance enhancement.
(Mel Gorman)
- Implement 'simple waitqueues' (swait): these are just pure
waitqueues without any of the more complex features of full-blown
waitqueues (callbacks, wake flags, wake keys, etc.). Simple
waitqueues have less memory overhead and are faster.
Use simple waitqueues in the RCU code (in 4 different places) and
for handling KVM vCPU wakeups.
(Peter Zijlstra, Daniel Wagner, Thomas Gleixner, Paul Gortmaker,
Marcelo Tosatti)
- sched/numa enhancements (Rik van Riel)
- NOHZ performance enhancements (Rik van Riel)
- Various sched/deadline enhancements (Steven Rostedt)
- Various fixes (Peter Zijlstra)
- ... and a number of other fixes, cleanups and smaller enhancements"
* 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (29 commits)
sched/cputime: Fix steal_account_process_tick() to always return jiffies
sched/deadline: Remove dl_new from struct sched_dl_entity
Revert "kbuild: Add option to turn incompatible pointer check into error"
sched/deadline: Remove superfluous call to switched_to_dl()
sched/debug: Fix preempt_disable_ip recording for preempt_disable()
sched, time: Switch VIRT_CPU_ACCOUNTING_GEN to jiffy granularity
time, acct: Drop irq save & restore from __acct_update_integrals()
acct, time: Change indentation in __acct_update_integrals()
sched, time: Remove non-power-of-two divides from __acct_update_integrals()
sched/rt: Kick RT bandwidth timer immediately on start up
sched/debug: Add deadline scheduler bandwidth ratio to /proc/sched_debug
sched/debug: Move sched_domain_sysctl to debug.c
sched/debug: Move the /sys/kernel/debug/sched_features file setup into debug.c
sched/rt: Fix PI handling vs. sched_setscheduler()
sched/core: Remove duplicated sched_group_set_shares() prototype
sched/fair: Consolidate nohz CPU load update code
sched/fair: Avoid using decay_load_missed() with a negative value
sched/deadline: Always calculate end of period on sched_yield()
sched/cgroup: Fix cgroup entity load tracking tear-down
rcu: Use simple wait queues where possible in rcutree
...
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/ftrace.h | 12 | ||||
| -rw-r--r-- | include/linux/kvm_host.h | 5 | ||||
| -rw-r--r-- | include/linux/latencytop.h | 3 | ||||
| -rw-r--r-- | include/linux/sched.h | 14 | ||||
| -rw-r--r-- | include/linux/sched/sysctl.h | 4 | ||||
| -rw-r--r-- | include/linux/swait.h | 172 | ||||
| -rw-r--r-- | include/linux/wait.h | 2 |
7 files changed, 202 insertions, 10 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index c2b340e23f62..6d9df3f7e334 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
| @@ -713,6 +713,18 @@ static inline void __ftrace_enabled_restore(int enabled) | |||
| 713 | #define CALLER_ADDR5 ((unsigned long)ftrace_return_address(5)) | 713 | #define CALLER_ADDR5 ((unsigned long)ftrace_return_address(5)) |
| 714 | #define CALLER_ADDR6 ((unsigned long)ftrace_return_address(6)) | 714 | #define CALLER_ADDR6 ((unsigned long)ftrace_return_address(6)) |
| 715 | 715 | ||
| 716 | static inline unsigned long get_lock_parent_ip(void) | ||
| 717 | { | ||
| 718 | unsigned long addr = CALLER_ADDR0; | ||
| 719 | |||
| 720 | if (!in_lock_functions(addr)) | ||
| 721 | return addr; | ||
| 722 | addr = CALLER_ADDR1; | ||
| 723 | if (!in_lock_functions(addr)) | ||
| 724 | return addr; | ||
| 725 | return CALLER_ADDR2; | ||
| 726 | } | ||
| 727 | |||
| 716 | #ifdef CONFIG_IRQSOFF_TRACER | 728 | #ifdef CONFIG_IRQSOFF_TRACER |
| 717 | extern void time_hardirqs_on(unsigned long a0, unsigned long a1); | 729 | extern void time_hardirqs_on(unsigned long a0, unsigned long a1); |
| 718 | extern void time_hardirqs_off(unsigned long a0, unsigned long a1); | 730 | extern void time_hardirqs_off(unsigned long a0, unsigned long a1); |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 861f690aa791..5276fe0916fc 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/irqflags.h> | 25 | #include <linux/irqflags.h> |
| 26 | #include <linux/context_tracking.h> | 26 | #include <linux/context_tracking.h> |
| 27 | #include <linux/irqbypass.h> | 27 | #include <linux/irqbypass.h> |
| 28 | #include <linux/swait.h> | ||
| 28 | #include <asm/signal.h> | 29 | #include <asm/signal.h> |
| 29 | 30 | ||
| 30 | #include <linux/kvm.h> | 31 | #include <linux/kvm.h> |
| @@ -218,7 +219,7 @@ struct kvm_vcpu { | |||
| 218 | int fpu_active; | 219 | int fpu_active; |
| 219 | int guest_fpu_loaded, guest_xcr0_loaded; | 220 | int guest_fpu_loaded, guest_xcr0_loaded; |
| 220 | unsigned char fpu_counter; | 221 | unsigned char fpu_counter; |
| 221 | wait_queue_head_t wq; | 222 | struct swait_queue_head wq; |
| 222 | struct pid *pid; | 223 | struct pid *pid; |
| 223 | int sigset_active; | 224 | int sigset_active; |
| 224 | sigset_t sigset; | 225 | sigset_t sigset; |
| @@ -782,7 +783,7 @@ static inline bool kvm_arch_has_assigned_device(struct kvm *kvm) | |||
| 782 | } | 783 | } |
| 783 | #endif | 784 | #endif |
| 784 | 785 | ||
| 785 | static inline wait_queue_head_t *kvm_arch_vcpu_wq(struct kvm_vcpu *vcpu) | 786 | static inline struct swait_queue_head *kvm_arch_vcpu_wq(struct kvm_vcpu *vcpu) |
| 786 | { | 787 | { |
| 787 | #ifdef __KVM_HAVE_ARCH_WQP | 788 | #ifdef __KVM_HAVE_ARCH_WQP |
| 788 | return vcpu->arch.wqp; | 789 | return vcpu->arch.wqp; |
diff --git a/include/linux/latencytop.h b/include/linux/latencytop.h index e23121f9d82a..59ccab297ae0 100644 --- a/include/linux/latencytop.h +++ b/include/linux/latencytop.h | |||
| @@ -37,6 +37,9 @@ account_scheduler_latency(struct task_struct *task, int usecs, int inter) | |||
| 37 | 37 | ||
| 38 | void clear_all_latency_tracing(struct task_struct *p); | 38 | void clear_all_latency_tracing(struct task_struct *p); |
| 39 | 39 | ||
| 40 | extern int sysctl_latencytop(struct ctl_table *table, int write, | ||
| 41 | void __user *buffer, size_t *lenp, loff_t *ppos); | ||
| 42 | |||
| 40 | #else | 43 | #else |
| 41 | 44 | ||
| 42 | static inline void | 45 | static inline void |
diff --git a/include/linux/sched.h b/include/linux/sched.h index a10494a94cc3..838a89a78332 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -182,8 +182,6 @@ extern void update_cpu_load_nohz(int active); | |||
| 182 | static inline void update_cpu_load_nohz(int active) { } | 182 | static inline void update_cpu_load_nohz(int active) { } |
| 183 | #endif | 183 | #endif |
| 184 | 184 | ||
| 185 | extern unsigned long get_parent_ip(unsigned long addr); | ||
| 186 | |||
| 187 | extern void dump_cpu_task(int cpu); | 185 | extern void dump_cpu_task(int cpu); |
| 188 | 186 | ||
| 189 | struct seq_file; | 187 | struct seq_file; |
| @@ -920,6 +918,10 @@ static inline int sched_info_on(void) | |||
| 920 | #endif | 918 | #endif |
| 921 | } | 919 | } |
| 922 | 920 | ||
| 921 | #ifdef CONFIG_SCHEDSTATS | ||
| 922 | void force_schedstat_enabled(void); | ||
| 923 | #endif | ||
| 924 | |||
| 923 | enum cpu_idle_type { | 925 | enum cpu_idle_type { |
| 924 | CPU_IDLE, | 926 | CPU_IDLE, |
| 925 | CPU_NOT_IDLE, | 927 | CPU_NOT_IDLE, |
| @@ -1289,6 +1291,8 @@ struct sched_rt_entity { | |||
| 1289 | unsigned long timeout; | 1291 | unsigned long timeout; |
| 1290 | unsigned long watchdog_stamp; | 1292 | unsigned long watchdog_stamp; |
| 1291 | unsigned int time_slice; | 1293 | unsigned int time_slice; |
| 1294 | unsigned short on_rq; | ||
| 1295 | unsigned short on_list; | ||
| 1292 | 1296 | ||
| 1293 | struct sched_rt_entity *back; | 1297 | struct sched_rt_entity *back; |
| 1294 | #ifdef CONFIG_RT_GROUP_SCHED | 1298 | #ifdef CONFIG_RT_GROUP_SCHED |
| @@ -1329,10 +1333,6 @@ struct sched_dl_entity { | |||
| 1329 | * task has to wait for a replenishment to be performed at the | 1333 | * task has to wait for a replenishment to be performed at the |
| 1330 | * next firing of dl_timer. | 1334 | * next firing of dl_timer. |
| 1331 | * | 1335 | * |
| 1332 | * @dl_new tells if a new instance arrived. If so we must | ||
| 1333 | * start executing it with full runtime and reset its absolute | ||
| 1334 | * deadline; | ||
| 1335 | * | ||
| 1336 | * @dl_boosted tells if we are boosted due to DI. If so we are | 1336 | * @dl_boosted tells if we are boosted due to DI. If so we are |
| 1337 | * outside bandwidth enforcement mechanism (but only until we | 1337 | * outside bandwidth enforcement mechanism (but only until we |
| 1338 | * exit the critical section); | 1338 | * exit the critical section); |
| @@ -1340,7 +1340,7 @@ struct sched_dl_entity { | |||
| 1340 | * @dl_yielded tells if task gave up the cpu before consuming | 1340 | * @dl_yielded tells if task gave up the cpu before consuming |
| 1341 | * all its available runtime during the last job. | 1341 | * all its available runtime during the last job. |
| 1342 | */ | 1342 | */ |
| 1343 | int dl_throttled, dl_new, dl_boosted, dl_yielded; | 1343 | int dl_throttled, dl_boosted, dl_yielded; |
| 1344 | 1344 | ||
| 1345 | /* | 1345 | /* |
| 1346 | * Bandwidth enforcement timer. Each -deadline task has its | 1346 | * Bandwidth enforcement timer. Each -deadline task has its |
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h index c9e4731cf10b..4f080ab4f2cd 100644 --- a/include/linux/sched/sysctl.h +++ b/include/linux/sched/sysctl.h | |||
| @@ -95,4 +95,8 @@ extern int sysctl_numa_balancing(struct ctl_table *table, int write, | |||
| 95 | void __user *buffer, size_t *lenp, | 95 | void __user *buffer, size_t *lenp, |
| 96 | loff_t *ppos); | 96 | loff_t *ppos); |
| 97 | 97 | ||
| 98 | extern int sysctl_schedstats(struct ctl_table *table, int write, | ||
| 99 | void __user *buffer, size_t *lenp, | ||
| 100 | loff_t *ppos); | ||
| 101 | |||
| 98 | #endif /* _SCHED_SYSCTL_H */ | 102 | #endif /* _SCHED_SYSCTL_H */ |
diff --git a/include/linux/swait.h b/include/linux/swait.h new file mode 100644 index 000000000000..c1f9c62a8a50 --- /dev/null +++ b/include/linux/swait.h | |||
| @@ -0,0 +1,172 @@ | |||
| 1 | #ifndef _LINUX_SWAIT_H | ||
| 2 | #define _LINUX_SWAIT_H | ||
| 3 | |||
| 4 | #include <linux/list.h> | ||
| 5 | #include <linux/stddef.h> | ||
| 6 | #include <linux/spinlock.h> | ||
| 7 | #include <asm/current.h> | ||
| 8 | |||
| 9 | /* | ||
| 10 | * Simple wait queues | ||
| 11 | * | ||
| 12 | * While these are very similar to the other/complex wait queues (wait.h) the | ||
| 13 | * most important difference is that the simple waitqueue allows for | ||
| 14 | * deterministic behaviour -- IOW it has strictly bounded IRQ and lock hold | ||
| 15 | * times. | ||
| 16 | * | ||
| 17 | * In order to make this so, we had to drop a fair number of features of the | ||
| 18 | * other waitqueue code; notably: | ||
| 19 | * | ||
| 20 | * - mixing INTERRUPTIBLE and UNINTERRUPTIBLE sleeps on the same waitqueue; | ||
| 21 | * all wakeups are TASK_NORMAL in order to avoid O(n) lookups for the right | ||
| 22 | * sleeper state. | ||
| 23 | * | ||
| 24 | * - the exclusive mode; because this requires preserving the list order | ||
| 25 | * and this is hard. | ||
| 26 | * | ||
| 27 | * - custom wake functions; because you cannot give any guarantees about | ||
| 28 | * random code. | ||
| 29 | * | ||
| 30 | * As a side effect of this; the data structures are slimmer. | ||
| 31 | * | ||
| 32 | * One would recommend using this wait queue where possible. | ||
| 33 | */ | ||
| 34 | |||
| 35 | struct task_struct; | ||
| 36 | |||
| 37 | struct swait_queue_head { | ||
| 38 | raw_spinlock_t lock; | ||
| 39 | struct list_head task_list; | ||
| 40 | }; | ||
| 41 | |||
| 42 | struct swait_queue { | ||
| 43 | struct task_struct *task; | ||
| 44 | struct list_head task_list; | ||
| 45 | }; | ||
| 46 | |||
| 47 | #define __SWAITQUEUE_INITIALIZER(name) { \ | ||
| 48 | .task = current, \ | ||
| 49 | .task_list = LIST_HEAD_INIT((name).task_list), \ | ||
| 50 | } | ||
| 51 | |||
| 52 | #define DECLARE_SWAITQUEUE(name) \ | ||
| 53 | struct swait_queue name = __SWAITQUEUE_INITIALIZER(name) | ||
| 54 | |||
| 55 | #define __SWAIT_QUEUE_HEAD_INITIALIZER(name) { \ | ||
| 56 | .lock = __RAW_SPIN_LOCK_UNLOCKED(name.lock), \ | ||
| 57 | .task_list = LIST_HEAD_INIT((name).task_list), \ | ||
| 58 | } | ||
| 59 | |||
| 60 | #define DECLARE_SWAIT_QUEUE_HEAD(name) \ | ||
| 61 | struct swait_queue_head name = __SWAIT_QUEUE_HEAD_INITIALIZER(name) | ||
| 62 | |||
| 63 | extern void __init_swait_queue_head(struct swait_queue_head *q, const char *name, | ||
| 64 | struct lock_class_key *key); | ||
| 65 | |||
| 66 | #define init_swait_queue_head(q) \ | ||
| 67 | do { \ | ||
| 68 | static struct lock_class_key __key; \ | ||
| 69 | __init_swait_queue_head((q), #q, &__key); \ | ||
| 70 | } while (0) | ||
| 71 | |||
| 72 | #ifdef CONFIG_LOCKDEP | ||
| 73 | # define __SWAIT_QUEUE_HEAD_INIT_ONSTACK(name) \ | ||
| 74 | ({ init_swait_queue_head(&name); name; }) | ||
| 75 | # define DECLARE_SWAIT_QUEUE_HEAD_ONSTACK(name) \ | ||
| 76 | struct swait_queue_head name = __SWAIT_QUEUE_HEAD_INIT_ONSTACK(name) | ||
| 77 | #else | ||
| 78 | # define DECLARE_SWAIT_QUEUE_HEAD_ONSTACK(name) \ | ||
| 79 | DECLARE_SWAIT_QUEUE_HEAD(name) | ||
| 80 | #endif | ||
| 81 | |||
| 82 | static inline int swait_active(struct swait_queue_head *q) | ||
| 83 | { | ||
| 84 | return !list_empty(&q->task_list); | ||
| 85 | } | ||
| 86 | |||
| 87 | extern void swake_up(struct swait_queue_head *q); | ||
| 88 | extern void swake_up_all(struct swait_queue_head *q); | ||
| 89 | extern void swake_up_locked(struct swait_queue_head *q); | ||
| 90 | |||
| 91 | extern void __prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait); | ||
| 92 | extern void prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait, int state); | ||
| 93 | extern long prepare_to_swait_event(struct swait_queue_head *q, struct swait_queue *wait, int state); | ||
| 94 | |||
| 95 | extern void __finish_swait(struct swait_queue_head *q, struct swait_queue *wait); | ||
| 96 | extern void finish_swait(struct swait_queue_head *q, struct swait_queue *wait); | ||
| 97 | |||
| 98 | /* as per ___wait_event() but for swait, therefore "exclusive == 0" */ | ||
| 99 | #define ___swait_event(wq, condition, state, ret, cmd) \ | ||
| 100 | ({ \ | ||
| 101 | struct swait_queue __wait; \ | ||
| 102 | long __ret = ret; \ | ||
| 103 | \ | ||
| 104 | INIT_LIST_HEAD(&__wait.task_list); \ | ||
| 105 | for (;;) { \ | ||
| 106 | long __int = prepare_to_swait_event(&wq, &__wait, state);\ | ||
| 107 | \ | ||
| 108 | if (condition) \ | ||
| 109 | break; \ | ||
| 110 | \ | ||
| 111 | if (___wait_is_interruptible(state) && __int) { \ | ||
| 112 | __ret = __int; \ | ||
| 113 | break; \ | ||
| 114 | } \ | ||
| 115 | \ | ||
| 116 | cmd; \ | ||
| 117 | } \ | ||
| 118 | finish_swait(&wq, &__wait); \ | ||
| 119 | __ret; \ | ||
| 120 | }) | ||
| 121 | |||
| 122 | #define __swait_event(wq, condition) \ | ||
| 123 | (void)___swait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, \ | ||
| 124 | schedule()) | ||
| 125 | |||
| 126 | #define swait_event(wq, condition) \ | ||
| 127 | do { \ | ||
| 128 | if (condition) \ | ||
| 129 | break; \ | ||
| 130 | __swait_event(wq, condition); \ | ||
| 131 | } while (0) | ||
| 132 | |||
| 133 | #define __swait_event_timeout(wq, condition, timeout) \ | ||
| 134 | ___swait_event(wq, ___wait_cond_timeout(condition), \ | ||
| 135 | TASK_UNINTERRUPTIBLE, timeout, \ | ||
| 136 | __ret = schedule_timeout(__ret)) | ||
| 137 | |||
| 138 | #define swait_event_timeout(wq, condition, timeout) \ | ||
| 139 | ({ \ | ||
| 140 | long __ret = timeout; \ | ||
| 141 | if (!___wait_cond_timeout(condition)) \ | ||
| 142 | __ret = __swait_event_timeout(wq, condition, timeout); \ | ||
| 143 | __ret; \ | ||
| 144 | }) | ||
| 145 | |||
| 146 | #define __swait_event_interruptible(wq, condition) \ | ||
| 147 | ___swait_event(wq, condition, TASK_INTERRUPTIBLE, 0, \ | ||
| 148 | schedule()) | ||
| 149 | |||
| 150 | #define swait_event_interruptible(wq, condition) \ | ||
| 151 | ({ \ | ||
| 152 | int __ret = 0; \ | ||
| 153 | if (!(condition)) \ | ||
| 154 | __ret = __swait_event_interruptible(wq, condition); \ | ||
| 155 | __ret; \ | ||
| 156 | }) | ||
| 157 | |||
| 158 | #define __swait_event_interruptible_timeout(wq, condition, timeout) \ | ||
| 159 | ___swait_event(wq, ___wait_cond_timeout(condition), \ | ||
| 160 | TASK_INTERRUPTIBLE, timeout, \ | ||
| 161 | __ret = schedule_timeout(__ret)) | ||
| 162 | |||
| 163 | #define swait_event_interruptible_timeout(wq, condition, timeout) \ | ||
| 164 | ({ \ | ||
| 165 | long __ret = timeout; \ | ||
| 166 | if (!___wait_cond_timeout(condition)) \ | ||
| 167 | __ret = __swait_event_interruptible_timeout(wq, \ | ||
| 168 | condition, timeout); \ | ||
| 169 | __ret; \ | ||
| 170 | }) | ||
| 171 | |||
| 172 | #endif /* _LINUX_SWAIT_H */ | ||
diff --git a/include/linux/wait.h b/include/linux/wait.h index ae71a769b89e..27d7a0ab5da3 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h | |||
| @@ -338,7 +338,7 @@ do { \ | |||
| 338 | schedule(); try_to_freeze()) | 338 | schedule(); try_to_freeze()) |
| 339 | 339 | ||
| 340 | /** | 340 | /** |
| 341 | * wait_event - sleep (or freeze) until a condition gets true | 341 | * wait_event_freezable - sleep (or freeze) until a condition gets true |
| 342 | * @wq: the waitqueue to wait on | 342 | * @wq: the waitqueue to wait on |
| 343 | * @condition: a C expression for the event to wait for | 343 | * @condition: a C expression for the event to wait for |
| 344 | * | 344 | * |
