diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2008-06-19 08:22:27 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-06-20 04:26:01 -0400 |
commit | 10b612f440a22a294e87ec7e8f03f9eea3338628 (patch) | |
tree | 75d016acdfa2e98a601bffa63ef302649f6ca7db | |
parent | eff6549b957d15d1ad168d90b8c1eb643b9c163f (diff) |
sched: rt: fix the bandwidth contraint computations
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: "Daniel K." <dk@uw.no>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/sched.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 5b307da827ef..1f711a58a2b4 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -8419,7 +8419,7 @@ static unsigned long to_ratio(u64 period, u64 runtime) | |||
8419 | #ifdef CONFIG_CGROUP_SCHED | 8419 | #ifdef CONFIG_CGROUP_SCHED |
8420 | static int __rt_schedulable(struct task_group *tg, u64 period, u64 runtime) | 8420 | static int __rt_schedulable(struct task_group *tg, u64 period, u64 runtime) |
8421 | { | 8421 | { |
8422 | struct task_group *tgi, *parent = tg ? tg->parent : NULL; | 8422 | struct task_group *tgi, *parent = tg->parent; |
8423 | unsigned long total = 0; | 8423 | unsigned long total = 0; |
8424 | 8424 | ||
8425 | if (!parent) { | 8425 | if (!parent) { |
@@ -8443,7 +8443,7 @@ static int __rt_schedulable(struct task_group *tg, u64 period, u64 runtime) | |||
8443 | } | 8443 | } |
8444 | rcu_read_unlock(); | 8444 | rcu_read_unlock(); |
8445 | 8445 | ||
8446 | return total + to_ratio(period, runtime) < | 8446 | return total + to_ratio(period, runtime) <= |
8447 | to_ratio(ktime_to_ns(parent->rt_bandwidth.rt_period), | 8447 | to_ratio(ktime_to_ns(parent->rt_bandwidth.rt_period), |
8448 | parent->rt_bandwidth.rt_runtime); | 8448 | parent->rt_bandwidth.rt_runtime); |
8449 | } | 8449 | } |
@@ -8560,10 +8560,15 @@ long sched_group_rt_period(struct task_group *tg) | |||
8560 | 8560 | ||
8561 | static int sched_rt_global_constraints(void) | 8561 | static int sched_rt_global_constraints(void) |
8562 | { | 8562 | { |
8563 | struct task_group *tg = &root_task_group; | ||
8564 | u64 rt_runtime, rt_period; | ||
8563 | int ret = 0; | 8565 | int ret = 0; |
8564 | 8566 | ||
8567 | rt_period = ktime_to_ns(tg->rt_bandwidth.rt_period); | ||
8568 | rt_runtime = tg->rt_bandwidth.rt_runtime; | ||
8569 | |||
8565 | mutex_lock(&rt_constraints_mutex); | 8570 | mutex_lock(&rt_constraints_mutex); |
8566 | if (!__rt_schedulable(NULL, 1, 0)) | 8571 | if (!__rt_schedulable(tg, rt_period, rt_runtime)) |
8567 | ret = -EINVAL; | 8572 | ret = -EINVAL; |
8568 | mutex_unlock(&rt_constraints_mutex); | 8573 | mutex_unlock(&rt_constraints_mutex); |
8569 | 8574 | ||