Commit 8cec3dd9 authored by Shrikanth Hegde's avatar Shrikanth Hegde Committed by Ingo Molnar

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: default avatarShrikanth Hegde <sshegde@linux.ibm.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Reviewed-by: default avatarVincent Guittot <vincent.guittot@linaro.org>
Link: https://lore.kernel.org/r/20240216061433.535522-1-sshegde@linux.ibm.com
parent 841c3516
...@@ -1792,7 +1792,6 @@ static void cpu_util_update_eff(struct cgroup_subsys_state *css); ...@@ -1792,7 +1792,6 @@ static void cpu_util_update_eff(struct cgroup_subsys_state *css);
#endif #endif
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
#ifdef CONFIG_UCLAMP_TASK
#ifdef CONFIG_UCLAMP_TASK_GROUP #ifdef CONFIG_UCLAMP_TASK_GROUP
static void uclamp_update_root_tg(void) static void uclamp_update_root_tg(void)
{ {
...@@ -1898,7 +1897,6 @@ static int sysctl_sched_uclamp_handler(struct ctl_table *table, int write, ...@@ -1898,7 +1897,6 @@ static int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
return result; return result;
} }
#endif #endif
#endif
static int uclamp_validate(struct task_struct *p, static int uclamp_validate(struct task_struct *p,
const struct sched_attr *attr) const struct sched_attr *attr)
...@@ -2065,7 +2063,7 @@ static void __init init_uclamp(void) ...@@ -2065,7 +2063,7 @@ static void __init init_uclamp(void)
} }
} }
#else /* CONFIG_UCLAMP_TASK */ #else /* !CONFIG_UCLAMP_TASK */
static inline void uclamp_rq_inc(struct rq *rq, struct task_struct *p) { } static inline void uclamp_rq_inc(struct rq *rq, struct task_struct *p) { }
static inline void uclamp_rq_dec(struct rq *rq, struct task_struct *p) { } static inline void uclamp_rq_dec(struct rq *rq, struct task_struct *p) { }
static inline int uclamp_validate(struct task_struct *p, static inline int uclamp_validate(struct task_struct *p,
......
...@@ -10182,10 +10182,8 @@ static int idle_cpu_without(int cpu, struct task_struct *p) ...@@ -10182,10 +10182,8 @@ static int idle_cpu_without(int cpu, struct task_struct *p)
* be computed and tested before calling idle_cpu_without(). * be computed and tested before calling idle_cpu_without().
*/ */
#ifdef CONFIG_SMP
if (rq->ttwu_pending) if (rq->ttwu_pending)
return 0; return 0;
#endif
return 1; return 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment