mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Fabio Checconi <fchecconi@gmail.com>
To: mingo@elte.hu, a.p.zijlstra@chello.nl
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 7/8] Reprogram timers only when necessary
Date: Mon, 15 Jun 2009 21:09:02 +0200	[thread overview]
Message-ID: <20090615190901.GQ21741@gandalf.sssup.it> (raw)
In-Reply-To: <cover.1245092261.git.fabio@helm.retis>

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


  parent reply	other threads:[~2009-06-15 19:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-15 18:55 [RFC][PATCH 0/8] Use EDF to throttle RT task groups Fabio Checconi
2009-06-15 18:56 ` [PATCH 1/8] Fix rt_rq->pushable_tasks initialization in init_rt_rq() Fabio Checconi
2009-07-09 10:43   ` Peter Zijlstra
2009-07-10 10:41   ` [tip:sched/urgent] sched: " tip-bot for Fabio Checconi
2009-06-15 19:05 ` [PATCH 2/8] Fix hrtick handling Fabio Checconi
2009-07-09 10:42   ` Peter Zijlstra
2009-06-15 19:06 ` [PATCH 3/8] Replace struct prio_array with an RB tree Fabio Checconi
2009-06-15 19:06 ` [PATCH 4/8] Remove the balancing logic Fabio Checconi
2009-06-15 19:08 ` [PATCH 5/8] Use EDF to throttle RT tasks hierarchically Fabio Checconi
2009-06-15 19:08 ` [PATCH 6/8] Modify the curr/next priority tracking Fabio Checconi
2009-06-15 19:09 ` Fabio Checconi [this message]
2009-06-15 19:09 ` [PATCH 8/8] Use hrtick when available Fabio Checconi
2009-07-09 10:36 ` [RFC][PATCH 0/8] Use EDF to throttle RT task groups Peter Zijlstra
2009-07-09 13:51   ` Fabio Checconi
2009-07-15  7:50     ` Peter Zijlstra
2009-07-15 12:08       ` Fabio Checconi
2009-07-15 14:25         ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090615190901.GQ21741@gandalf.sssup.it \
    --to=fchecconi@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®