Skip to content

Commit 8cec3dd

Browse files
Shrikanth HegdeIngo Molnar
authored andcommitted
sched/core: Simplify code by removing duplicate #ifdefs
There's a few cases of nested #ifdefs in the scheduler code that can be simplified: #ifdef DEFINE_A ...code block... #ifdef DEFINE_A <-- This is a duplicate. ...code block... #endif #else #ifndef DEFINE_A <-- This is also duplicate. ...code block... #endif #endif More details about the script and methods used to find these code patterns can be found at: https://lore.kernel.org/all/20240118080326.13137-1-sshegde@linux.ibm.com/ No change in functionality intended. [ mingo: Clarified the changelog. ] Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org> Link: https://lore.kernel.org/r/20240216061433.535522-1-sshegde@linux.ibm.com
1 parent 841c351 commit 8cec3dd

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

kernel/sched/core.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,7 +1792,6 @@ static void cpu_util_update_eff(struct cgroup_subsys_state *css);
17921792
#endif
17931793

17941794
#ifdef CONFIG_SYSCTL
1795-
#ifdef CONFIG_UCLAMP_TASK
17961795
#ifdef CONFIG_UCLAMP_TASK_GROUP
17971796
static void uclamp_update_root_tg(void)
17981797
{
@@ -1898,7 +1897,6 @@ static int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
18981897
return result;
18991898
}
19001899
#endif
1901-
#endif
19021900

19031901
static int uclamp_validate(struct task_struct *p,
19041902
const struct sched_attr *attr)
@@ -2065,7 +2063,7 @@ static void __init init_uclamp(void)
20652063
}
20662064
}
20672065

2068-
#else /* CONFIG_UCLAMP_TASK */
2066+
#else /* !CONFIG_UCLAMP_TASK */
20692067
static inline void uclamp_rq_inc(struct rq *rq, struct task_struct *p) { }
20702068
static inline void uclamp_rq_dec(struct rq *rq, struct task_struct *p) { }
20712069
static inline int uclamp_validate(struct task_struct *p,

kernel/sched/fair.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10182,10 +10182,8 @@ static int idle_cpu_without(int cpu, struct task_struct *p)
1018210182
* be computed and tested before calling idle_cpu_without().
1018310183
*/
1018410184

10185-
#ifdef CONFIG_SMP
1018610185
if (rq->ttwu_pending)
1018710186
return 0;
10188-
#endif
1018910187

1019010188
return 1;
1019110189
}

0 commit comments

Comments
 (0)