aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/sched.c11
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
8420static int __rt_schedulable(struct task_group *tg, u64 period, u64 runtime) 8420static 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
8561static int sched_rt_global_constraints(void) 8561static 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