public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/rt: fix rt timer activation/deactivation
@ 2014-02-25 16:05 Juri Lelli
  2014-02-25 20:56 ` Kirill Tkhai
  0 siblings, 1 reply; 7+ messages in thread
From: Juri Lelli @ 2014-02-25 16:05 UTC (permalink / raw)
  To: mingo, peterz; +Cc: linux-kernel, Juri Lelli

Destroy rt bandwidth timer when rq has no more RT tasks, even when
CONFIG_RT_GROUP_SCHED is not set.

Signed-off-by: Juri Lelli <juri.lelli@gmail.com>
---
 kernel/sched/rt.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index a2740b7..7dba25a 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -86,12 +86,12 @@ void init_rt_rq(struct rt_rq *rt_rq, struct rq *rq)
 	raw_spin_lock_init(&rt_rq->rt_runtime_lock);
 }
 
-#ifdef CONFIG_RT_GROUP_SCHED
 static void destroy_rt_bandwidth(struct rt_bandwidth *rt_b)
 {
 	hrtimer_cancel(&rt_b->rt_period_timer);
 }
 
+#ifdef CONFIG_RT_GROUP_SCHED
 #define rt_entity_is_task(rt_se) (!(rt_se)->my_q)
 
 static inline struct task_struct *rt_task_of(struct sched_rt_entity *rt_se)
@@ -1011,8 +1011,12 @@ inc_rt_group(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
 	start_rt_bandwidth(&def_rt_bandwidth);
 }
 
-static inline
-void dec_rt_group(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq) {}
+static void
+dec_rt_group(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
+{
+	if (!rt_rq->rt_nr_running)
+		destroy_rt_bandwidth(&def_rt_bandwidth);
+}
 
 #endif /* CONFIG_RT_GROUP_SCHED */
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-02-26 10:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-25 16:05 [PATCH] sched/rt: fix rt timer activation/deactivation Juri Lelli
2014-02-25 20:56 ` Kirill Tkhai
2014-02-26  2:37   ` Mike Galbraith
2014-02-26  9:07     ` Peter Zijlstra
2014-02-26  9:35       ` Kirill Tkhai
2014-02-26 10:01         ` Kirill Tkhai
2014-02-26 10:02       ` Mike Galbraith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox