* Re: sched/rt: Pick up the throttled rt tasks in case no other non-rt tasks
2013-10-16 15:43 sched/rt: Pick up the throttled rt tasks in case no other non-rt tasks Chuansheng Liu
@ 2013-10-16 6:56 ` Mike Galbraith
0 siblings, 0 replies; 2+ messages in thread
From: Mike Galbraith @ 2013-10-16 6:56 UTC (permalink / raw)
To: Chuansheng Liu; +Cc: mingo, peterz, linux-kernel
On Wed, 2013-10-16 at 23:43 +0800, Chuansheng Liu wrote:
> Meet the case that on CPU2, there are just two tasks to be run,
> one is one rt task A, another is idle task, but at this time,
> and the rt_rq is throttled.
>
> CPU1 CPU2
> staying in idle task;
> waking up rt task A on
> target CPU 2;
>
> exiting from idle task;
> DO schedule()
> pick up RT next task
> pick_next_task_rt()
> _pick_next_task_rt()
> rt_rq is throttled
> return NULL rt task to be picked
>
> CPU2 then went into idle task AGAIN;
> after 2s, CPU2 is waken up again;
> rt task A is get running;
>
> Here rt task A is delayed for some time, even when CPU2 is in idle state.
>
> so in case there are just rt tasks running, we can pick up one of them
> even rt_rq is throttled.
And shortly thereafter, a SCHED_NORMAL task wakes.. only to find that
its alleged bodyguard slit its throat while it slept. Bad bodyguard.
-Mike
^ permalink raw reply [flat|nested] 2+ messages in thread
* sched/rt: Pick up the throttled rt tasks in case no other non-rt tasks
@ 2013-10-16 15:43 Chuansheng Liu
2013-10-16 6:56 ` Mike Galbraith
0 siblings, 1 reply; 2+ messages in thread
From: Chuansheng Liu @ 2013-10-16 15:43 UTC (permalink / raw)
To: mingo, peterz; +Cc: linux-kernel, chuansheng.liu
Meet the case that on CPU2, there are just two tasks to be run,
one is one rt task A, another is idle task, but at this time,
and the rt_rq is throttled.
CPU1 CPU2
staying in idle task;
waking up rt task A on
target CPU 2;
exiting from idle task;
DO schedule()
pick up RT next task
pick_next_task_rt()
_pick_next_task_rt()
rt_rq is throttled
return NULL rt task to be picked
CPU2 then went into idle task AGAIN;
after 2s, CPU2 is waken up again;
rt task A is get running;
Here rt task A is delayed for some time, even when CPU2 is in idle state.
so in case there are just rt tasks running, we can pick up one of them
even rt_rq is throttled.
Signed-off-by: Liu, Chuansheng <chuansheng.liu@intel.com>
---
kernel/sched/rt.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 01970c8..d521050 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1305,8 +1305,16 @@ static struct task_struct *_pick_next_task_rt(struct rq *rq)
if (!rt_rq->rt_nr_running)
return NULL;
- if (rt_rq_throttled(rt_rq))
- return NULL;
+ if (rt_rq_throttled(rt_rq)) {
+ /*
+ * If in current rq, expects for idle task, the other tasks
+ * are rt tasks, we should continue to pick one of the rt tasks.
+ * Otherwise, the rt tasks will be delayed while current
+ * CPU is in idle.
+ */
+ if ((rt_rq->rt_nr_running + 1) != rq->nr_running)
+ return NULL;
+ }
do {
rt_se = pick_next_rt_entity(rq, rt_rq);
--
1.7.9.5
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-16 6:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-16 15:43 sched/rt: Pick up the throttled rt tasks in case no other non-rt tasks Chuansheng Liu
2013-10-16 6:56 ` Mike Galbraith
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®