[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <49231385567953@web4m.yandex.ru>
Date: Wed, 27 Nov 2013 19:59:13 +0400
From: Kirill Tkhai <tkhai@...dex.ru>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Cc: Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Steven Rostedt <rostedt@...dmis.org>, stable@...r.kernel.org
Subject: [PATCH] sched/rt: Fix rq's cpupri leak while enqueue/dequeue child RT entities
This patch touches RT group scheduling case.
Functions inc_rt_prio_smp() and dec_rt_prio_smp() change (global) rq's priority,
while rt_rq passed to them may be not the top-level rt_rq. This is wrong, because
changing of priority on a child level does not guarantee that the priority is
the highest all over the rq. So, this leak makes RT balancing unusable.
The short example: the task having the highest priority among all rq's RT tasks
(no one other task has the same priority) are waking on a throttle rt_rq.
The rq's cpupri is set to the task's priority equivalent, but real
rq->rt.highest_prio.curr is less.
The patch below fixes the problem.
It looks like all version have this bug, so I CC'ed stable mailing list.
Signed-off-by: Kirill Tkhai <tkhai@...dex.ru>
CC: Ingo Molnar <mingo@...hat.com>
CC: Peter Zijlstra <peterz@...radead.org>
CC: Steven Rostedt <rostedt@...dmis.org>
CC: stable@...r.kernel.org
---
kernel/sched/rt.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 7d57275..1c40655 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -901,6 +901,13 @@ inc_rt_prio_smp(struct rt_rq *rt_rq, int prio, int prev_prio)
{
struct rq *rq = rq_of_rt_rq(rt_rq);
+#ifdef CONFIG_RT_GROUP_SCHED
+ /*
+ * Change rq's cpupri only if rt_rq is the top queue.
+ */
+ if (&rq->rt != rt_rq)
+ return;
+#endif
if (rq->online && prio < prev_prio)
cpupri_set(&rq->rd->cpupri, rq->cpu, prio);
}
@@ -910,6 +917,13 @@ dec_rt_prio_smp(struct rt_rq *rt_rq, int prio, int prev_prio)
{
struct rq *rq = rq_of_rt_rq(rt_rq);
+#ifdef CONFIG_RT_GROUP_SCHED
+ /*
+ * Change rq's cpupri only if rt_rq is the top queue.
+ */
+ if (&rq->rt != rt_rq)
+ return;
+#endif
if (rq->online && rt_rq->highest_prio.curr != prev_prio)
cpupri_set(&rq->rd->cpupri, rq->cpu, rt_rq->highest_prio.curr);
}
--
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