Skip to content

Commit 433bce5

Browse files
WerkovPeter Zijlstra
authored andcommitted
sched: Convert CONFIG_RT_GROUP_SCHED macros to code conditions
Convert the blocks guarded by macros to regular code so that the RT group code gets more compile validation. Reasoning is in Documentation/process/coding-style.rst 21) Conditional Compilation. With that, no functional change is expected. Signed-off-by: Michal Koutný <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent f2d6506 commit 433bce5

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

kernel/sched/rt.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,13 +1066,12 @@ inc_rt_prio_smp(struct rt_rq *rt_rq, int prio, int prev_prio)
10661066
{
10671067
struct rq *rq = rq_of_rt_rq(rt_rq);
10681068

1069-
#ifdef CONFIG_RT_GROUP_SCHED
10701069
/*
10711070
* Change rq's cpupri only if rt_rq is the top queue.
10721071
*/
1073-
if (&rq->rt != rt_rq)
1072+
if (IS_ENABLED(CONFIG_RT_GROUP_SCHED) && &rq->rt != rt_rq)
10741073
return;
1075-
#endif
1074+
10761075
if (rq->online && prio < prev_prio)
10771076
cpupri_set(&rq->rd->cpupri, rq->cpu, prio);
10781077
}
@@ -1082,13 +1081,12 @@ dec_rt_prio_smp(struct rt_rq *rt_rq, int prio, int prev_prio)
10821081
{
10831082
struct rq *rq = rq_of_rt_rq(rt_rq);
10841083

1085-
#ifdef CONFIG_RT_GROUP_SCHED
10861084
/*
10871085
* Change rq's cpupri only if rt_rq is the top queue.
10881086
*/
1089-
if (&rq->rt != rt_rq)
1087+
if (IS_ENABLED(CONFIG_RT_GROUP_SCHED) && &rq->rt != rt_rq)
10901088
return;
1091-
#endif
1089+
10921090
if (rq->online && rt_rq->highest_prio.curr != prev_prio)
10931091
cpupri_set(&rq->rd->cpupri, rq->cpu, rt_rq->highest_prio.curr);
10941092
}

kernel/sched/syscalls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ int __sched_setscheduler(struct task_struct *p,
640640
retval = -EPERM;
641641
goto unlock;
642642
}
643-
#endif
643+
#endif /* CONFIG_RT_GROUP_SCHED */
644644
#ifdef CONFIG_SMP
645645
if (dl_bandwidth_enabled() && dl_policy(policy) &&
646646
!(attr->sched_flags & SCHED_FLAG_SUGOV)) {

0 commit comments

Comments
 (0)