Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 100206
b: refs/heads/master
c: b79f383
h: refs/heads/master
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Jun 20, 2008
1 parent f28ba2f commit 4736324
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ada18de2eb76961a4d4847f63291744c9e7beec4
refs/heads/master: b79f3833d81d54fc71d98c8064dc45f33a755a8a
41 changes: 29 additions & 12 deletions trunk/kernel/sched_rt.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,28 @@ static inline struct rt_bandwidth *sched_rt_bandwidth(struct rt_rq *rt_rq)

#endif

#ifdef CONFIG_SMP
static int do_balance_runtime(struct rt_rq *rt_rq);

static int balance_runtime(struct rt_rq *rt_rq)
{
int more = 0;

if (rt_rq->rt_time > rt_rq->rt_runtime) {
spin_unlock(&rt_rq->rt_runtime_lock);
more = do_balance_runtime(rt_rq);
spin_lock(&rt_rq->rt_runtime_lock);
}

return more;
}
#else
static inline int balance_runtime(struct rt_rq *rt_rq)
{
return 0;
}
#endif

static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun)
{
int i, idle = 1;
Expand All @@ -247,6 +269,8 @@ static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun)
u64 runtime;

spin_lock(&rt_rq->rt_runtime_lock);
if (rt_rq->rt_throttled)
balance_runtime(rt_rq);
runtime = rt_rq->rt_runtime;
rt_rq->rt_time -= min(rt_rq->rt_time, overrun*runtime);
if (rt_rq->rt_throttled && rt_rq->rt_time < runtime) {
Expand All @@ -267,7 +291,7 @@ static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun)
}

#ifdef CONFIG_SMP
static int balance_runtime(struct rt_rq *rt_rq)
static int do_balance_runtime(struct rt_rq *rt_rq)
{
struct rt_bandwidth *rt_b = sched_rt_bandwidth(rt_rq);
struct root_domain *rd = cpu_rq(smp_processor_id())->rd;
Expand Down Expand Up @@ -428,17 +452,10 @@ static int sched_rt_runtime_exceeded(struct rt_rq *rt_rq)
if (sched_rt_runtime(rt_rq) >= sched_rt_period(rt_rq))
return 0;

#ifdef CONFIG_SMP
if (rt_rq->rt_time > runtime) {
spin_unlock(&rt_rq->rt_runtime_lock);
balance_runtime(rt_rq);
spin_lock(&rt_rq->rt_runtime_lock);

runtime = sched_rt_runtime(rt_rq);
if (runtime == RUNTIME_INF)
return 0;
}
#endif
balance_runtime(rt_rq);
runtime = sched_rt_runtime(rt_rq);
if (runtime == RUNTIME_INF)
return 0;

if (rt_rq->rt_time > runtime) {
rt_rq->rt_throttled = 1;
Expand Down

0 comments on commit 4736324

Please sign in to comment.