Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 87035
b: refs/heads/master
c: 521f1a2
h: refs/heads/master
i:
  87033: f108b31
  87031: 822696e
v: v3
  • Loading branch information
Dhaval Giani authored and Ingo Molnar committed Mar 7, 2008
1 parent 5640d35 commit 1cc8729
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2692a2406b9262bbb101708815be99ec2988e48b
refs/heads/master: 521f1a2489c41f8b1181b0a8eb52e1c34284d50b
17 changes: 17 additions & 0 deletions trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -7750,6 +7750,17 @@ static int __rt_schedulable(struct task_group *tg, u64 period, u64 runtime)
return total + to_ratio(period, runtime) < global_ratio;
}

/* Must be called with tasklist_lock held */
static inline int tg_has_rt_tasks(struct task_group *tg)
{
struct task_struct *g, *p;
do_each_thread(g, p) {
if (rt_task(p) && rt_rq_of_se(&p->rt)->tg == tg)
return 1;
} while_each_thread(g, p);
return 0;
}

int sched_group_set_rt_runtime(struct task_group *tg, long rt_runtime_us)
{
u64 rt_runtime, rt_period;
Expand All @@ -7761,12 +7772,18 @@ int sched_group_set_rt_runtime(struct task_group *tg, long rt_runtime_us)
rt_runtime = RUNTIME_INF;

mutex_lock(&rt_constraints_mutex);
read_lock(&tasklist_lock);
if (rt_runtime_us == 0 && tg_has_rt_tasks(tg)) {
err = -EBUSY;
goto unlock;
}
if (!__rt_schedulable(tg, rt_period, rt_runtime)) {
err = -EINVAL;
goto unlock;
}
tg->rt_runtime = rt_runtime;
unlock:
read_unlock(&tasklist_lock);
mutex_unlock(&rt_constraints_mutex);

return err;
Expand Down

0 comments on commit 1cc8729

Please sign in to comment.