diff options
Diffstat (limited to 'kernel/sched/rt.c')
-rw-r--r-- | kernel/sched/rt.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index a2740b775b45..72f9ec759972 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c | |||
@@ -229,6 +229,8 @@ int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent) | |||
229 | 229 | ||
230 | #ifdef CONFIG_SMP | 230 | #ifdef CONFIG_SMP |
231 | 231 | ||
232 | static int pull_rt_task(struct rq *this_rq); | ||
233 | |||
232 | static inline int rt_overloaded(struct rq *rq) | 234 | static inline int rt_overloaded(struct rq *rq) |
233 | { | 235 | { |
234 | return atomic_read(&rq->rd->rto_count); | 236 | return atomic_read(&rq->rd->rto_count); |
@@ -1310,15 +1312,7 @@ static struct task_struct *_pick_next_task_rt(struct rq *rq) | |||
1310 | { | 1312 | { |
1311 | struct sched_rt_entity *rt_se; | 1313 | struct sched_rt_entity *rt_se; |
1312 | struct task_struct *p; | 1314 | struct task_struct *p; |
1313 | struct rt_rq *rt_rq; | 1315 | struct rt_rq *rt_rq = &rq->rt; |
1314 | |||
1315 | rt_rq = &rq->rt; | ||
1316 | |||
1317 | if (!rt_rq->rt_nr_running) | ||
1318 | return NULL; | ||
1319 | |||
1320 | if (rt_rq_throttled(rt_rq)) | ||
1321 | return NULL; | ||
1322 | 1316 | ||
1323 | do { | 1317 | do { |
1324 | rt_se = pick_next_rt_entity(rq, rt_rq); | 1318 | rt_se = pick_next_rt_entity(rq, rt_rq); |
@@ -1332,9 +1326,28 @@ static struct task_struct *_pick_next_task_rt(struct rq *rq) | |||
1332 | return p; | 1326 | return p; |
1333 | } | 1327 | } |
1334 | 1328 | ||
1335 | static struct task_struct *pick_next_task_rt(struct rq *rq) | 1329 | static struct task_struct * |
1330 | pick_next_task_rt(struct rq *rq, struct task_struct *prev) | ||
1336 | { | 1331 | { |
1337 | struct task_struct *p = _pick_next_task_rt(rq); | 1332 | struct task_struct *p; |
1333 | struct rt_rq *rt_rq = &rq->rt; | ||
1334 | |||
1335 | #ifdef CONFIG_SMP | ||
1336 | /* Try to pull RT tasks here if we lower this rq's prio */ | ||
1337 | if (rq->rt.highest_prio.curr > prev->prio) | ||
1338 | pull_rt_task(rq); | ||
1339 | #endif | ||
1340 | |||
1341 | if (!rt_rq->rt_nr_running) | ||
1342 | return NULL; | ||
1343 | |||
1344 | if (rt_rq_throttled(rt_rq)) | ||
1345 | return NULL; | ||
1346 | |||
1347 | if (prev) | ||
1348 | prev->sched_class->put_prev_task(rq, prev); | ||
1349 | |||
1350 | p = _pick_next_task_rt(rq); | ||
1338 | 1351 | ||
1339 | /* The running task is never eligible for pushing */ | 1352 | /* The running task is never eligible for pushing */ |
1340 | if (p) | 1353 | if (p) |
@@ -1716,13 +1729,6 @@ skip: | |||
1716 | return ret; | 1729 | return ret; |
1717 | } | 1730 | } |
1718 | 1731 | ||
1719 | static void pre_schedule_rt(struct rq *rq, struct task_struct *prev) | ||
1720 | { | ||
1721 | /* Try to pull RT tasks here if we lower this rq's prio */ | ||
1722 | if (rq->rt.highest_prio.curr > prev->prio) | ||
1723 | pull_rt_task(rq); | ||
1724 | } | ||
1725 | |||
1726 | static void post_schedule_rt(struct rq *rq) | 1732 | static void post_schedule_rt(struct rq *rq) |
1727 | { | 1733 | { |
1728 | push_rt_tasks(rq); | 1734 | push_rt_tasks(rq); |
@@ -1999,7 +2005,6 @@ const struct sched_class rt_sched_class = { | |||
1999 | .set_cpus_allowed = set_cpus_allowed_rt, | 2005 | .set_cpus_allowed = set_cpus_allowed_rt, |
2000 | .rq_online = rq_online_rt, | 2006 | .rq_online = rq_online_rt, |
2001 | .rq_offline = rq_offline_rt, | 2007 | .rq_offline = rq_offline_rt, |
2002 | .pre_schedule = pre_schedule_rt, | ||
2003 | .post_schedule = post_schedule_rt, | 2008 | .post_schedule = post_schedule_rt, |
2004 | .task_woken = task_woken_rt, | 2009 | .task_woken = task_woken_rt, |
2005 | .switched_from = switched_from_rt, | 2010 | .switched_from = switched_from_rt, |