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>
This commit is contained in:
parent
6092848a2a
commit
4d9842776a
1 changed files with 16 additions and 24 deletions
|
@ -550,30 +550,28 @@ static void update_curr_rt(struct rq *rq)
|
||||||
static inline
|
static inline
|
||||||
void inc_rt_tasks(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
|
void inc_rt_tasks(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
|
||||||
{
|
{
|
||||||
WARN_ON(!rt_prio(rt_se_prio(rt_se)));
|
int prio = rt_se_prio(rt_se);
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
struct rq *rq = rq_of_rt_rq(rt_rq);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
WARN_ON(!rt_prio(prio));
|
||||||
rt_rq->rt_nr_running++;
|
rt_rq->rt_nr_running++;
|
||||||
#if defined CONFIG_SMP || defined CONFIG_RT_GROUP_SCHED
|
#if defined CONFIG_SMP || defined CONFIG_RT_GROUP_SCHED
|
||||||
if (rt_se_prio(rt_se) < rt_rq->highest_prio) {
|
if (prio < rt_rq->highest_prio) {
|
||||||
#ifdef CONFIG_SMP
|
|
||||||
struct rq *rq = rq_of_rt_rq(rt_rq);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
rt_rq->highest_prio = rt_se_prio(rt_se);
|
rt_rq->highest_prio = prio;
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
if (rq->online)
|
if (rq->online)
|
||||||
cpupri_set(&rq->rd->cpupri, rq->cpu,
|
cpupri_set(&rq->rd->cpupri, rq->cpu, prio);
|
||||||
rt_se_prio(rt_se));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
if (rt_se->nr_cpus_allowed > 1) {
|
if (rt_se->nr_cpus_allowed > 1)
|
||||||
struct rq *rq = rq_of_rt_rq(rt_rq);
|
|
||||||
|
|
||||||
rq->rt.rt_nr_migratory++;
|
rq->rt.rt_nr_migratory++;
|
||||||
}
|
|
||||||
|
|
||||||
update_rt_migration(rq_of_rt_rq(rt_rq));
|
update_rt_migration(rq);
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_RT_GROUP_SCHED
|
#ifdef CONFIG_RT_GROUP_SCHED
|
||||||
if (rt_se_boosted(rt_se))
|
if (rt_se_boosted(rt_se))
|
||||||
|
@ -590,6 +588,7 @@ static inline
|
||||||
void dec_rt_tasks(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
|
void dec_rt_tasks(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
|
struct rq *rq = rq_of_rt_rq(rt_rq);
|
||||||
int highest_prio = rt_rq->highest_prio;
|
int highest_prio = rt_rq->highest_prio;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -611,20 +610,13 @@ void dec_rt_tasks(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
|
||||||
rt_rq->highest_prio = MAX_RT_PRIO;
|
rt_rq->highest_prio = MAX_RT_PRIO;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
if (rt_se->nr_cpus_allowed > 1) {
|
if (rt_se->nr_cpus_allowed > 1)
|
||||||
struct rq *rq = rq_of_rt_rq(rt_rq);
|
|
||||||
rq->rt.rt_nr_migratory--;
|
rq->rt.rt_nr_migratory--;
|
||||||
}
|
|
||||||
|
|
||||||
if (rt_rq->highest_prio != highest_prio) {
|
if (rq->online && rt_rq->highest_prio != highest_prio)
|
||||||
struct rq *rq = rq_of_rt_rq(rt_rq);
|
cpupri_set(&rq->rd->cpupri, rq->cpu, rt_rq->highest_prio);
|
||||||
|
|
||||||
if (rq->online)
|
update_rt_migration(rq);
|
||||||
cpupri_set(&rq->rd->cpupri, rq->cpu,
|
|
||||||
rt_rq->highest_prio);
|
|
||||||
}
|
|
||||||
|
|
||||||
update_rt_migration(rq_of_rt_rq(rt_rq));
|
|
||||||
#endif /* CONFIG_SMP */
|
#endif /* CONFIG_SMP */
|
||||||
#ifdef CONFIG_RT_GROUP_SCHED
|
#ifdef CONFIG_RT_GROUP_SCHED
|
||||||
if (rt_se_boosted(rt_se))
|
if (rt_se_boosted(rt_se))
|
||||||
|
|
Loading…
Reference in a new issue