aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2008-01-25 15:08:31 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-25 15:08:31 -0500
commit48d5e258216f1c7713633439beb98a38c7290649 (patch)
tree6f8c98785015d56337e87ed56b23d39feeeaf846 /kernel/sched.c
parent614ee1f61f667b02165c1ae0c1357048dc6d94a0 (diff)
sched: rt throttling vs no_hz
We need to teach no_hz about the rt throttling because its tick driven. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 5ea2c533b432..22712b2e058a 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -442,6 +442,7 @@ struct rq {
442 struct cfs_rq cfs; 442 struct cfs_rq cfs;
443 struct rt_rq rt; 443 struct rt_rq rt;
444 u64 rt_period_expire; 444 u64 rt_period_expire;
445 int rt_throttled;
445 446
446#ifdef CONFIG_FAIR_GROUP_SCHED 447#ifdef CONFIG_FAIR_GROUP_SCHED
447 /* list of leaf cfs_rq on this cpu: */ 448 /* list of leaf cfs_rq on this cpu: */
@@ -594,6 +595,23 @@ static void update_rq_clock(struct rq *rq)
594#define task_rq(p) cpu_rq(task_cpu(p)) 595#define task_rq(p) cpu_rq(task_cpu(p))
595#define cpu_curr(cpu) (cpu_rq(cpu)->curr) 596#define cpu_curr(cpu) (cpu_rq(cpu)->curr)
596 597
598unsigned long rt_needs_cpu(int cpu)
599{
600 struct rq *rq = cpu_rq(cpu);
601 u64 delta;
602
603 if (!rq->rt_throttled)
604 return 0;
605
606 if (rq->clock > rq->rt_period_expire)
607 return 1;
608
609 delta = rq->rt_period_expire - rq->clock;
610 do_div(delta, NSEC_PER_SEC / HZ);
611
612 return (unsigned long)delta;
613}
614
597/* 615/*
598 * Tunables that become constants when CONFIG_SCHED_DEBUG is off: 616 * Tunables that become constants when CONFIG_SCHED_DEBUG is off:
599 */ 617 */
@@ -7102,9 +7120,11 @@ static void init_rt_rq(struct rt_rq *rt_rq, struct rq *rq)
7102 /* delimiter for bitsearch: */ 7120 /* delimiter for bitsearch: */
7103 __set_bit(MAX_RT_PRIO, array->bitmap); 7121 __set_bit(MAX_RT_PRIO, array->bitmap);
7104 7122
7123#if defined CONFIG_SMP || defined CONFIG_FAIR_GROUP_SCHED
7124 rt_rq->highest_prio = MAX_RT_PRIO;
7125#endif
7105#ifdef CONFIG_SMP 7126#ifdef CONFIG_SMP
7106 rt_rq->rt_nr_migratory = 0; 7127 rt_rq->rt_nr_migratory = 0;
7107 rt_rq->highest_prio = MAX_RT_PRIO;
7108 rt_rq->overloaded = 0; 7128 rt_rq->overloaded = 0;
7109#endif 7129#endif
7110 7130
@@ -7191,6 +7211,7 @@ void __init sched_init(void)
7191 &per_cpu(init_sched_rt_entity, i), i, 1); 7211 &per_cpu(init_sched_rt_entity, i), i, 1);
7192#endif 7212#endif
7193 rq->rt_period_expire = 0; 7213 rq->rt_period_expire = 0;
7214 rq->rt_throttled = 0;
7194 7215
7195 for (j = 0; j < CPU_LOAD_IDX_MAX; j++) 7216 for (j = 0; j < CPU_LOAD_IDX_MAX; j++)
7196 rq->cpu_load[j] = 0; 7217 rq->cpu_load[j] = 0;