scheduler fixes
Linus,
Please pull the latest sched-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched-urgent-for-linus
Thanks,
Ingo
------------------>
Carsten Emde (1):
sched: Set the command name of the idle tasks in SMP kernels
Hui Kang (1):
sched_fair: Fix a typo in the comment describing update_sd_lb_stats
J. Bruce Fields (1):
sched: Document wait_for_completion_*() return values
Paul Turner (1):
sched: Fix buglet in return_cfs_rq_runtime()
Peter Zijlstra (3):
sched: Add a comment to effective_load() since it's a pain sched, rt: Provide means of disabling cross-cpu bandwidth sharing
sched: Avoid SMT siblings in select_idle_sibling() if possible
Salman Qazi (1):
sched, x86: Avoid unnecessary overflow in sched_clock
arch/x86/include/asm/timer.h | 23 ++++++- include/linux/init_task.h | 4 +- kernel/sched.c | 17 +++++ kernel/sched_fair.c | 159 +++++++++++++++++++++++++++++++++--------- kernel/sched_features.h | 1 + kernel/sched_rt.c | 3 + 6 files changed, 171 insertions(+), 36 deletions(-)
arch/x86/include/asm/timer.h +22 -1
@@ -32,6 +32,22 @@ extern int no_timer_check;* ([email protected]) * * [email protected] "math is hard, lets go shopping!" +* +* In: +* +* ns = cycles * cyc2ns_scale / SC +* +* Although we may still have enough bits to store the value of ns, +* in some cases, we may not have enough bits to store cycles * cyc2ns_scale, +* leading to an incorrect result. +* +* To avoid this, we can decompose 'cycles' into quotient and remainder +* of division by SC. Then, +* +* ns = (quot * SC + rem) * cyc2ns_scale / SC +* = quot * cyc2ns_scale + (rem * cyc2ns_scale) / SC +* +* - [email protected] */ DECLARE_PER_CPU(unsigned long, cyc2ns);
@@ -41,9 +57,14 @@ DECLARE_PER_CPU(unsigned long long, cyc2ns_offset);static inline unsigned long long __cycles_2_ns (unsigned long long cyc) { +unsigned long long quot; +unsigned long long rem;int cpu =smp_processor_id ();unsigned long long ns =per_cpu (cyc2ns_offset, cpu); - ns += cyc *per_cpu (cyc2ns, cpu) >>CYC2NS_SCALE_FACTOR ; + quot = (cyc >>CYC2NS_SCALE_FACTOR ); + rem = cyc & ((1ULL <<CYC2NS_SCALE_FACTOR ) -1 ); + ns += quot *per_cpu (cyc2ns, cpu) + + ((rem *per_cpu (cyc2ns, cpu)) >>CYC2NS_SCALE_FACTOR );return ns; }
include/linux/init_task.h +3 -1
@@ -126,6 +126,8 @@ extern struct cred init_cred;# define INIT_PERF_EVENTS (tsk)#endif +#define INIT_TASK_COMM "swapper" +/* * INIT_TASK is used to set up the first task table, touch at * your own risk!. Base=0, limit=0x1fffff (=2MB)
@@ -162,7 +164,7 @@ extern struct cred init_cred; .group_leader = &tsk, \ RCU_INIT_POINTER(.real_cred, &init_cred), \ RCU_INIT_POINTER(.cred, &init_cred), \ - .comm = "swapper", \ + .comm = INIT_TASK_COMM, \ .thread = INIT_THREAD, \ .fs = &init_fs, \ .files = &init_files, \
kernel/sched.c +17 -0
@@ -71,6 +71,7 @@#include <linux/ctype.h> #include <linux/ftrace.h> #include <linux/slab.h> +#include <linux/init_task.h> #include <asm/tlb.h> #include <asm/irq_regs.h>
@@ -4810,6 +4811,9 @@ EXPORT_SYMBOL(wait_for_completion);* This waits for either a completion of a specific task to be signaled or for a * specified timeout to expire. The timeout is in jiffies. It is not * interruptible. +* +* The return value is 0 if timed out, and positive (at least 1, or number of +* jiffies left till timeout) if completed. */ unsigned long __sched wait_for_completion_timeout (struct completion *x,unsigned long timeout)
@@ -4824,6 +4828,8 @@ EXPORT_SYMBOL(wait_for_completion_timeout);* * This waits for completion of a specific task to be signaled. It is * interruptible. +* +* The return value is -ERESTARTSYS if interrupted, 0 if completed. */ int __sched wait_for_completion_interruptible(struct completion *x) {
@@ -4841,6 +4847,9 @@ EXPORT_SYMBOL(wait_for_completion_interruptible);* * This waits for either a completion of a specific task to be signaled or for a * specified timeout to expire. It is interruptible. The timeout is in jiffies. +* +* The return value is -ERESTARTSYS if interrupted, 0 if timed out, +* positive (at least 1, or number of jiffies left till timeout) if completed. */ long __sched wait_for_completion_interruptible_timeout(struct completion *x,
@@ -4856,6 +4865,8 @@ EXPORT_SYMBOL(wait_for_completion_interruptible_timeout);* * This waits to be signaled for completion of a specific task. It can be * interrupted by a kill signal. +* +* The return value is -ERESTARTSYS if interrupted, 0 if completed. */ int __sched wait_for_completion_killable(struct completion *x) {
@@ -4874,6 +4885,9 @@ EXPORT_SYMBOL(wait_for_completion_killable);* This waits for either a completion of a specific task to be * signaled or for a specified timeout to expire. It can be * interrupted by a kill signal. The timeout is in jiffies. +* +* The return value is -ERESTARTSYS if interrupted, 0 if timed out, +* positive (at least 1, or number of jiffies left till timeout) if completed. */ long __sched wait_for_completion_killable_timeout(struct completion *x,
@@ -6099,6 +6113,9 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu)*/ idle->sched_class = &idle_sched_class;ftrace_graph_init_idle_task (idle, cpu); +#if defined(CONFIG_SMP ) +sprintf (idle->comm,"%s/%d" ,INIT_TASK_COMM , cpu); +#endif }/*
kernel/sched_fair.c +125 -34
226 lines not on this page · raw message
kernel/sched_features.h +1 -0
@@ -67,3 +67,4 @@ SCHED_FEAT(NONTASK_POWER, 1) SCHED_FEAT(TTWU_QUEUE, 1) SCHED_FEAT(FORCE_SD_OVERLAP, 0) +SCHED_FEAT (RT_RUNTIME_SHARE ,1 )
kernel/sched_rt.c +3 -0
@@ -560,6 +560,9 @@ static int balance_runtime(struct rt_rq *rt_rq) {int more =0 ; +if (!sched_feat (RT_RUNTIME_SHARE )) +return more; +if (rt_rq->rt_time > rt_rq->rt_runtime) {raw_spin_unlock (&rt_rq->rt_runtime_lock); more =do_balance_runtime (rt_rq);