aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched/rt.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched/rt.c')
-rw-r--r--kernel/sched/rt.c41
1 files changed, 30 insertions, 11 deletions
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 65c2d6881ac3..3e488ca6050d 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -231,6 +231,12 @@ int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent)
231 231
232static int pull_rt_task(struct rq *this_rq); 232static int pull_rt_task(struct rq *this_rq);
233 233
234static inline bool need_pull_rt_task(struct rq *rq, struct task_struct *prev)
235{
236 /* Try to pull RT tasks here if we lower this rq's prio */
237 return rq->rt.highest_prio.curr > prev->prio;
238}
239
234static inline int rt_overloaded(struct rq *rq) 240static inline int rt_overloaded(struct rq *rq)
235{ 241{
236 return atomic_read(&rq->rd->rto_count); 242 return atomic_read(&rq->rd->rto_count);
@@ -317,6 +323,15 @@ static inline int has_pushable_tasks(struct rq *rq)
317 return !plist_head_empty(&rq->rt.pushable_tasks); 323 return !plist_head_empty(&rq->rt.pushable_tasks);
318} 324}
319 325
326static inline void set_post_schedule(struct rq *rq)
327{
328 /*
329 * We detect this state here so that we can avoid taking the RQ
330 * lock again later if there is no need to push
331 */
332 rq->post_schedule = has_pushable_tasks(rq);
333}
334
320static void enqueue_pushable_task(struct rq *rq, struct task_struct *p) 335static void enqueue_pushable_task(struct rq *rq, struct task_struct *p)
321{ 336{
322 plist_del(&p->pushable_tasks, &rq->rt.pushable_tasks); 337 plist_del(&p->pushable_tasks, &rq->rt.pushable_tasks);
@@ -361,6 +376,19 @@ void dec_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
361{ 376{
362} 377}
363 378
379static inline bool need_pull_rt_task(struct rq *rq, struct task_struct *prev)
380{
381 return false;
382}
383
384static inline int pull_rt_task(struct rq *this_rq)
385{
386 return 0;
387}
388
389static inline void set_post_schedule(struct rq *rq)
390{
391}
364#endif /* CONFIG_SMP */ 392#endif /* CONFIG_SMP */
365 393
366static inline int on_rt_rq(struct sched_rt_entity *rt_se) 394static inline int on_rt_rq(struct sched_rt_entity *rt_se)
@@ -1332,11 +1360,8 @@ pick_next_task_rt(struct rq *rq, struct task_struct *prev)
1332 struct task_struct *p; 1360 struct task_struct *p;
1333 struct rt_rq *rt_rq = &rq->rt; 1361 struct rt_rq *rt_rq = &rq->rt;
1334 1362
1335#ifdef CONFIG_SMP 1363 if (need_pull_rt_task(rq, prev))
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); 1364 pull_rt_task(rq);
1339#endif
1340 1365
1341 if (!rt_rq->rt_nr_running) 1366 if (!rt_rq->rt_nr_running)
1342 return NULL; 1367 return NULL;
@@ -1352,13 +1377,7 @@ pick_next_task_rt(struct rq *rq, struct task_struct *prev)
1352 if (p) 1377 if (p)
1353 dequeue_pushable_task(rq, p); 1378 dequeue_pushable_task(rq, p);
1354 1379
1355#ifdef CONFIG_SMP 1380 set_post_schedule(rq);
1356 /*
1357 * We detect this state here so that we can avoid taking the RQ
1358 * lock again later if there is no need to push
1359 */
1360 rq->post_schedule = has_pushable_tasks(rq);
1361#endif
1362 1381
1363 return p; 1382 return p;
1364} 1383}