[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090615190901.GQ21741@gandalf.sssup.it>
Date: Mon, 15 Jun 2009 21:09:02 +0200
From: Fabio Checconi <fchecconi@...il.com>
To: mingo@...e.hu, a.p.zijlstra@...llo.nl
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH 7/8] Reprogram timers only when necessary
Avoid unnecessary timer reprogramming when a group is at its full
capacity and it is already enqueued. Such a group will not need
further budget recharges until it astually consumes its budget, so
do not rearm its timer immediately.
---
kernel/sched_rt.c | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index f43ce7b..a9db16b 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -386,6 +386,19 @@ static int do_sched_rt_period_timer(struct rt_rq *rt_rq, int overrun)
return idle;
}
+static inline int rt_rq_needs_recharge(struct rt_rq *rt_rq)
+{
+ struct sched_rt_entity *rt_se = rt_rq->rt_se;
+
+ if (rt_rq->rt_time)
+ return 1;
+
+ if (!rt_se)
+ return 0;
+
+ return !on_rt_rq(rt_rq->rt_se);
+}
+
static enum hrtimer_restart sched_rt_period_timer(struct hrtimer *timer)
{
struct rt_rq *rt_rq = container_of(timer, struct rt_rq,
@@ -402,7 +415,8 @@ static enum hrtimer_restart sched_rt_period_timer(struct hrtimer *timer)
idle = do_sched_rt_period_timer(rt_rq, overrun);
}
- return idle ? HRTIMER_NORESTART : HRTIMER_RESTART;
+ return idle || !rt_rq_needs_recharge(rt_rq) ?
+ HRTIMER_NORESTART : HRTIMER_RESTART;
}
static void start_rt_period_timer(struct rt_rq *rt_rq)
@@ -428,6 +442,9 @@ static void start_rt_period_timer(struct rt_rq *rt_rq)
if (overrun)
__do_sched_rt_period_timer(rt_rq, overrun);
+ if (!rt_rq_needs_recharge(rt_rq))
+ return;
+
soft = hrtimer_get_softexpires(&rt_rq->rt_period_timer);
hard = hrtimer_get_expires(&rt_rq->rt_period_timer);
range = ktime_to_ns(ktime_sub(hard, soft));
--
1.6.2.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists