aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorGregory Haskins <ghaskins@novell.com>2008-12-29 09:39:49 -0500
committerGregory Haskins <ghaskins@novell.com>2008-12-29 09:39:49 -0500
commit4d9842776a23e52ec4c60e0a79f5e1bbe91e463e (patch)
treefe628d0453c757297a84d43134e6f89153662c41 /kernel
parent6092848a2a23b660150a38bc06f59d75838d70c8 (diff)
sched: cleanup inc/dec_rt_tasks
Move some common definitions up to the function prologe to simplify the body logic. Signed-off-by: Gregory Haskins <ghaskins@novell.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched_rt.c40
1 files changed, 16 insertions, 24 deletions
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 1bbd99014011..0a5277233452 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -550,30 +550,28 @@ static void update_curr_rt(struct rq *rq)
550static inline 550static inline
551void inc_rt_tasks(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq) 551void inc_rt_tasks(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
552{ 552{
553 WARN_ON(!rt_prio(rt_se_prio(rt_se))); 553 int prio = rt_se_prio(rt_se);
554 rt_rq->rt_nr_running++;
555#if defined CONFIG_SMP || defined CONFIG_RT_GROUP_SCHED
556 if (rt_se_prio(rt_se) < rt_rq->highest_prio) {
557#ifdef CONFIG_SMP 554#ifdef CONFIG_SMP
558 struct rq *rq = rq_of_rt_rq(rt_rq); 555 struct rq *rq = rq_of_rt_rq(rt_rq);
559#endif 556#endif
560 557
561 rt_rq->highest_prio = rt_se_prio(rt_se); 558 WARN_ON(!rt_prio(prio));
559 rt_rq->rt_nr_running++;
560#if defined CONFIG_SMP || defined CONFIG_RT_GROUP_SCHED
561 if (prio < rt_rq->highest_prio) {
562
563 rt_rq->highest_prio = prio;
562#ifdef CONFIG_SMP 564#ifdef CONFIG_SMP
563 if (rq->online) 565 if (rq->online)
564 cpupri_set(&rq->rd->cpupri, rq->cpu, 566 cpupri_set(&rq->rd->cpupri, rq->cpu, prio);
565 rt_se_prio(rt_se));
566#endif 567#endif
567 } 568 }
568#endif 569#endif
569#ifdef CONFIG_SMP 570#ifdef CONFIG_SMP
570 if (rt_se->nr_cpus_allowed > 1) { 571 if (rt_se->nr_cpus_allowed > 1)
571 struct rq *rq = rq_of_rt_rq(rt_rq);
572
573 rq->rt.rt_nr_migratory++; 572 rq->rt.rt_nr_migratory++;
574 }
575 573
576 update_rt_migration(rq_of_rt_rq(rt_rq)); 574 update_rt_migration(rq);
577#endif 575#endif
578#ifdef CONFIG_RT_GROUP_SCHED 576#ifdef CONFIG_RT_GROUP_SCHED
579 if (rt_se_boosted(rt_se)) 577 if (rt_se_boosted(rt_se))
@@ -590,6 +588,7 @@ static inline
590void dec_rt_tasks(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq) 588void dec_rt_tasks(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
591{ 589{
592#ifdef CONFIG_SMP 590#ifdef CONFIG_SMP
591 struct rq *rq = rq_of_rt_rq(rt_rq);
593 int highest_prio = rt_rq->highest_prio; 592 int highest_prio = rt_rq->highest_prio;
594#endif 593#endif
595 594
@@ -611,20 +610,13 @@ void dec_rt_tasks(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
611 rt_rq->highest_prio = MAX_RT_PRIO; 610 rt_rq->highest_prio = MAX_RT_PRIO;
612#endif 611#endif
613#ifdef CONFIG_SMP 612#ifdef CONFIG_SMP
614 if (rt_se->nr_cpus_allowed > 1) { 613 if (rt_se->nr_cpus_allowed > 1)
615 struct rq *rq = rq_of_rt_rq(rt_rq);
616 rq->rt.rt_nr_migratory--; 614 rq->rt.rt_nr_migratory--;
617 }
618 615
619 if (rt_rq->highest_prio != highest_prio) { 616 if (rq->online && rt_rq->highest_prio != highest_prio)
620 struct rq *rq = rq_of_rt_rq(rt_rq); 617 cpupri_set(&rq->rd->cpupri, rq->cpu, rt_rq->highest_prio);
621
622 if (rq->online)
623 cpupri_set(&rq->rd->cpupri, rq->cpu,
624 rt_rq->highest_prio);
625 }
626 618
627 update_rt_migration(rq_of_rt_rq(rt_rq)); 619 update_rt_migration(rq);
628#endif /* CONFIG_SMP */ 620#endif /* CONFIG_SMP */
629#ifdef CONFIG_RT_GROUP_SCHED 621#ifdef CONFIG_RT_GROUP_SCHED
630 if (rt_se_boosted(rt_se)) 622 if (rt_se_boosted(rt_se))