aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2008-04-19 13:45:00 -0400
committerIngo Molnar <mingo@elte.hu>2008-04-19 13:45:00 -0400
commitb40b2e8eb52192a8a22d707ed37925792b7bdfd1 (patch)
tree88a20a3fc5a3d80ad7f5db4cd26255e14fd82642 /kernel/sched.c
parentf473aa5e025bc8e0c5fe9352f65178a54adadec2 (diff)
sched: rt: multi level group constraints
multi level rt constraints 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.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index debb06a4a660..475e3fcab738 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -8228,6 +8228,38 @@ static unsigned long to_ratio(u64 period, u64 runtime)
8228 return div64_64(runtime << 16, period); 8228 return div64_64(runtime << 16, period);
8229} 8229}
8230 8230
8231#ifdef CONFIG_CGROUP_SCHED
8232static int __rt_schedulable(struct task_group *tg, u64 period, u64 runtime)
8233{
8234 struct task_group *tgi, *parent = tg->parent;
8235 unsigned long total = 0;
8236
8237 if (!parent) {
8238 if (global_rt_period() < period)
8239 return 0;
8240
8241 return to_ratio(period, runtime) <
8242 to_ratio(global_rt_period(), global_rt_runtime());
8243 }
8244
8245 if (ktime_to_ns(parent->rt_bandwidth.rt_period) < period)
8246 return 0;
8247
8248 rcu_read_lock();
8249 list_for_each_entry_rcu(tgi, &parent->children, siblings) {
8250 if (tgi == tg)
8251 continue;
8252
8253 total += to_ratio(ktime_to_ns(tgi->rt_bandwidth.rt_period),
8254 tgi->rt_bandwidth.rt_runtime);
8255 }
8256 rcu_read_unlock();
8257
8258 return total + to_ratio(period, runtime) <
8259 to_ratio(ktime_to_ns(parent->rt_bandwidth.rt_period),
8260 parent->rt_bandwidth.rt_runtime);
8261}
8262#elif defined CONFIG_USER_SCHED
8231static int __rt_schedulable(struct task_group *tg, u64 period, u64 runtime) 8263static int __rt_schedulable(struct task_group *tg, u64 period, u64 runtime)
8232{ 8264{
8233 struct task_group *tgi; 8265 struct task_group *tgi;
@@ -8247,6 +8279,7 @@ static int __rt_schedulable(struct task_group *tg, u64 period, u64 runtime)
8247 8279
8248 return total + to_ratio(period, runtime) < global_ratio; 8280 return total + to_ratio(period, runtime) < global_ratio;
8249} 8281}
8282#endif
8250 8283
8251/* Must be called with tasklist_lock held */ 8284/* Must be called with tasklist_lock held */
8252static inline int tg_has_rt_tasks(struct task_group *tg) 8285static inline int tg_has_rt_tasks(struct task_group *tg)