Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched: Clean up and standardize #if/#else/#endif markers in sched/fair.c

- Use the standard #ifdef marker format for larger blocks,
where appropriate:

#if CONFIG_FOO
...
#else /* !CONFIG_FOO: */
...
#endif /* !CONFIG_FOO */

- Fix whitespace noise and other inconsistencies.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Valentin Schneider <vschneid@redhat.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lore.kernel.org/r/20250528080924.2273858-10-mingo@kernel.org

+56 -55
+56 -55
kernel/sched/fair.c
··· 111 111 * (default: ~5%) 112 112 */ 113 113 #define capacity_greater(cap1, cap2) ((cap1) * 1024 > (cap2) * 1078) 114 - #endif 114 + #endif /* CONFIG_SMP */ 115 115 116 116 #ifdef CONFIG_CFS_BANDWIDTH 117 117 /* ··· 162 162 return 0; 163 163 } 164 164 late_initcall(sched_fair_sysctl_init); 165 - #endif 165 + #endif /* CONFIG_SYSCTL */ 166 166 167 167 static inline void update_load_add(struct load_weight *lw, unsigned long inc) 168 168 { ··· 471 471 return cfs_rq_is_idle(group_cfs_rq(se)); 472 472 } 473 473 474 - #else /* !CONFIG_FAIR_GROUP_SCHED */ 474 + #else /* !CONFIG_FAIR_GROUP_SCHED: */ 475 475 476 476 #define for_each_sched_entity(se) \ 477 477 for (; se; se = NULL) ··· 517 517 return task_has_idle_policy(task_of(se)); 518 518 } 519 519 520 - #endif /* CONFIG_FAIR_GROUP_SCHED */ 520 + #endif /* !CONFIG_FAIR_GROUP_SCHED */ 521 521 522 522 static __always_inline 523 523 void account_cfs_rq_runtime(struct cfs_rq *cfs_rq, u64 delta_exec); ··· 1008 1008 1009 1009 return 0; 1010 1010 } 1011 - #endif 1011 + #endif /* CONFIG_SMP */ 1012 1012 1013 1013 static void clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se); 1014 1014 ··· 1041 1041 } 1042 1042 1043 1043 #include "pelt.h" 1044 + 1044 1045 #ifdef CONFIG_SMP 1045 1046 1046 1047 static int select_idle_sibling(struct task_struct *p, int prev_cpu, int cpu); ··· 1132 1131 sa->runnable_avg = sa->util_avg; 1133 1132 } 1134 1133 1135 - #else /* !CONFIG_SMP */ 1134 + #else /* !CONFIG_SMP: */ 1136 1135 void init_entity_runnable_average(struct sched_entity *se) 1137 1136 { 1138 1137 } ··· 1142 1141 static void update_tg_load_avg(struct cfs_rq *cfs_rq) 1143 1142 { 1144 1143 } 1145 - #endif /* CONFIG_SMP */ 1144 + #endif /* !CONFIG_SMP */ 1146 1145 1147 1146 static s64 update_curr_se(struct rq *rq, struct sched_entity *curr) 1148 1147 { ··· 2115 2114 2116 2115 return idle_core; 2117 2116 } 2118 - #else 2117 + #else /* !CONFIG_SCHED_SMT: */ 2119 2118 static inline int numa_idle_core(int idle_core, int cpu) 2120 2119 { 2121 2120 return idle_core; 2122 2121 } 2123 - #endif 2122 + #endif /* !CONFIG_SCHED_SMT */ 2124 2123 2125 2124 /* 2126 2125 * Gather all necessary information to make NUMA balancing placement ··· 3674 3673 p->numa_scan_period = task_scan_start(p); 3675 3674 } 3676 3675 3677 - #else 3676 + #else /* !CONFIG_NUMA_BALANCING: */ 3677 + 3678 3678 static void task_tick_numa(struct rq *rq, struct task_struct *curr) 3679 3679 { 3680 3680 } ··· 3692 3690 { 3693 3691 } 3694 3692 3695 - #endif /* CONFIG_NUMA_BALANCING */ 3693 + #endif /* !CONFIG_NUMA_BALANCING */ 3696 3694 3697 3695 static void 3698 3696 account_entity_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se) ··· 3787 3785 cfs_rq->avg.load_sum = max_t(u32, cfs_rq->avg.load_sum, 3788 3786 cfs_rq->avg.load_avg * PELT_MIN_DIVIDER); 3789 3787 } 3790 - #else 3788 + #else /* !CONFIG_SMP: */ 3791 3789 static inline void 3792 3790 enqueue_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se) { } 3793 3791 static inline void 3794 3792 dequeue_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se) { } 3795 - #endif 3793 + #endif /* !CONFIG_SMP */ 3796 3794 3797 3795 static void place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags); 3798 3796 ··· 4002 4000 reweight_entity(cfs_rq_of(se), se, shares); 4003 4001 } 4004 4002 4005 - #else /* CONFIG_FAIR_GROUP_SCHED */ 4003 + #else /* !CONFIG_FAIR_GROUP_SCHED: */ 4006 4004 static inline void update_cfs_group(struct sched_entity *se) 4007 4005 { 4008 4006 } 4009 - #endif /* CONFIG_FAIR_GROUP_SCHED */ 4007 + #endif /* !CONFIG_FAIR_GROUP_SCHED */ 4010 4008 4011 4009 static inline void cfs_rq_util_change(struct cfs_rq *cfs_rq, int flags) 4012 4010 { ··· 4483 4481 return true; 4484 4482 } 4485 4483 4486 - #else /* CONFIG_FAIR_GROUP_SCHED */ 4484 + #else /* !CONFIG_FAIR_GROUP_SCHED: */ 4487 4485 4488 4486 static inline void update_tg_load_avg(struct cfs_rq *cfs_rq) {} 4489 4487 ··· 4496 4494 4497 4495 static inline void add_tg_cfs_propagate(struct cfs_rq *cfs_rq, long runnable_sum) {} 4498 4496 4499 - #endif /* CONFIG_FAIR_GROUP_SCHED */ 4497 + #endif /* !CONFIG_FAIR_GROUP_SCHED */ 4500 4498 4501 4499 #ifdef CONFIG_NO_HZ_COMMON 4502 4500 static inline void migrate_se_pelt_lag(struct sched_entity *se) ··· 4577 4575 4578 4576 __update_load_avg_blocked_se(now, se); 4579 4577 } 4580 - #else 4578 + #else /* !CONFIG_NO_HZ_COMMON: */ 4581 4579 static void migrate_se_pelt_lag(struct sched_entity *se) {} 4582 - #endif 4580 + #endif /* !CONFIG_NO_HZ_COMMON */ 4583 4581 4584 4582 /** 4585 4583 * update_cfs_rq_load_avg - update the cfs_rq's load/util averages ··· 5146 5144 rq->misfit_task_load = max_t(unsigned long, task_h_load(p), 1); 5147 5145 } 5148 5146 5149 - #else /* CONFIG_SMP */ 5147 + #else /* !CONFIG_SMP: */ 5150 5148 5151 5149 static inline bool cfs_rq_is_decayed(struct cfs_rq *cfs_rq) 5152 5150 { ··· 5186 5184 bool task_sleep) {} 5187 5185 static inline void update_misfit_status(struct task_struct *p, struct rq *rq) {} 5188 5186 5189 - #endif /* CONFIG_SMP */ 5187 + #endif /* !CONFIG_SMP */ 5190 5188 5191 5189 void __setparam_fair(struct task_struct *p, const struct sched_attr *attr) 5192 5190 { ··· 5687 5685 { 5688 5686 static_key_slow_dec_cpuslocked(&__cfs_bandwidth_used); 5689 5687 } 5690 - #else /* CONFIG_JUMP_LABEL */ 5688 + #else /* !CONFIG_JUMP_LABEL: */ 5691 5689 static bool cfs_bandwidth_used(void) 5692 5690 { 5693 5691 return true; ··· 5695 5693 5696 5694 void cfs_bandwidth_usage_inc(void) {} 5697 5695 void cfs_bandwidth_usage_dec(void) {} 5698 - #endif /* CONFIG_JUMP_LABEL */ 5696 + #endif /* !CONFIG_JUMP_LABEL */ 5699 5697 5700 5698 /* 5701 5699 * default period for cfs group bandwidth. ··· 6149 6147 if (first) 6150 6148 smp_call_function_single_async(cpu_of(rq), &rq->cfsb_csd); 6151 6149 } 6152 - #else 6150 + #else /* !CONFIG_SMP: */ 6153 6151 static inline void __unthrottle_cfs_rq_async(struct cfs_rq *cfs_rq) 6154 6152 { 6155 6153 unthrottle_cfs_rq(cfs_rq); 6156 6154 } 6157 - #endif 6155 + #endif /* !CONFIG_SMP */ 6158 6156 6159 6157 static void unthrottle_cfs_rq_async(struct cfs_rq *cfs_rq) 6160 6158 { ··· 6735 6733 if (cfs_task_bw_constrained(p)) 6736 6734 tick_nohz_dep_set_cpu(cpu, TICK_DEP_BIT_SCHED); 6737 6735 } 6738 - #endif 6736 + #endif /* CONFIG_NO_HZ_FULL */ 6739 6737 6740 - #else /* CONFIG_CFS_BANDWIDTH */ 6738 + #else /* !CONFIG_CFS_BANDWIDTH: */ 6741 6739 6742 6740 static void account_cfs_rq_runtime(struct cfs_rq *cfs_rq, u64 delta_exec) {} 6743 6741 static bool check_cfs_rq_runtime(struct cfs_rq *cfs_rq) { return false; } ··· 6779 6777 return false; 6780 6778 } 6781 6779 #endif 6782 - #endif /* CONFIG_CFS_BANDWIDTH */ 6780 + #endif /* !CONFIG_CFS_BANDWIDTH */ 6783 6781 6784 6782 #if !defined(CONFIG_CFS_BANDWIDTH) || !defined(CONFIG_NO_HZ_FULL) 6785 6783 static inline void sched_fair_update_stop_tick(struct rq *rq, struct task_struct *p) {} ··· 6824 6822 6825 6823 hrtick_start_fair(rq, donor); 6826 6824 } 6827 - #else /* !CONFIG_SCHED_HRTICK */ 6825 + #else /* !CONFIG_SCHED_HRTICK: */ 6828 6826 static inline void 6829 6827 hrtick_start_fair(struct rq *rq, struct task_struct *p) 6830 6828 { ··· 6833 6831 static inline void hrtick_update(struct rq *rq) 6834 6832 { 6835 6833 } 6836 - #endif 6834 + #endif /* !CONFIG_SCHED_HRTICK */ 6837 6835 6838 6836 #ifdef CONFIG_SMP 6839 6837 static inline bool cpu_overutilized(int cpu) ··· 6877 6875 if (!is_rd_overutilized(rq->rd) && cpu_overutilized(rq->cpu)) 6878 6876 set_rd_overutilized(rq->rd, 1); 6879 6877 } 6880 - #else 6878 + #else /* !CONFIG_SMP: */ 6881 6879 static inline void check_update_overutilized_status(struct rq *rq) { } 6882 - #endif 6880 + #endif /* !CONFIG_SMP */ 6883 6881 6884 6882 /* Runqueue only has SCHED_IDLE tasks enqueued */ 6885 6883 static int sched_idle_rq(struct rq *rq) ··· 7679 7677 return -1; 7680 7678 } 7681 7679 7682 - #else /* CONFIG_SCHED_SMT */ 7680 + #else /* !CONFIG_SCHED_SMT: */ 7683 7681 7684 7682 static inline void set_idle_cores(int cpu, int val) 7685 7683 { ··· 7700 7698 return -1; 7701 7699 } 7702 7700 7703 - #endif /* CONFIG_SCHED_SMT */ 7701 + #endif /* !CONFIG_SCHED_SMT */ 7704 7702 7705 7703 /* 7706 7704 * Scan the LLC domain for idle CPUs; this is dynamically regulated by ··· 8745 8743 8746 8744 return sched_balance_newidle(rq, rf) != 0; 8747 8745 } 8748 - #else 8746 + #else /* !CONFIG_SMP: */ 8749 8747 static inline void set_task_max_allowed_capacity(struct task_struct *p) {} 8750 - #endif /* CONFIG_SMP */ 8748 + #endif /* !CONFIG_SMP */ 8751 8749 8752 8750 static void set_next_buddy(struct sched_entity *se) 8753 8751 { ··· 8941 8939 return p; 8942 8940 8943 8941 simple: 8944 - #endif 8942 + #endif /* CONFIG_FAIR_GROUP_SCHED */ 8945 8943 put_prev_set_next_task(rq, prev, p); 8946 8944 return p; 8947 8945 ··· 9359 9357 return src_weight - dst_weight; 9360 9358 } 9361 9359 9362 - #else 9360 + #else /* !CONFIG_NUMA_BALANCING: */ 9363 9361 static inline long migrate_degrades_locality(struct task_struct *p, 9364 9362 struct lb_env *env) 9365 9363 { 9366 9364 return 0; 9367 9365 } 9368 - #endif 9366 + #endif /* !CONFIG_NUMA_BALANCING */ 9369 9367 9370 9368 /* 9371 9369 * Check whether the task is ineligible on the destination cpu ··· 9774 9772 if (!has_blocked) 9775 9773 rq->has_blocked_load = 0; 9776 9774 } 9777 - #else 9775 + #else /* !CONFIG_NO_HZ_COMMON: */ 9778 9776 static inline bool cfs_rq_has_blocked(struct cfs_rq *cfs_rq) { return false; } 9779 9777 static inline bool others_have_blocked(struct rq *rq) { return false; } 9780 9778 static inline void update_blocked_load_tick(struct rq *rq) {} 9781 9779 static inline void update_blocked_load_status(struct rq *rq, bool has_blocked) {} 9782 - #endif 9780 + #endif /* !CONFIG_NO_HZ_COMMON */ 9783 9781 9784 9782 static bool __update_blocked_others(struct rq *rq, bool *done) 9785 9783 { ··· 9888 9886 return div64_ul(p->se.avg.load_avg * cfs_rq->h_load, 9889 9887 cfs_rq_load_avg(cfs_rq) + 1); 9890 9888 } 9891 - #else 9889 + #else /* !CONFIG_FAIR_GROUP_SCHED: */ 9892 9890 static bool __update_blocked_fair(struct rq *rq, bool *done) 9893 9891 { 9894 9892 struct cfs_rq *cfs_rq = &rq->cfs; ··· 9905 9903 { 9906 9904 return p->se.avg.load_avg; 9907 9905 } 9908 - #endif 9906 + #endif /* !CONFIG_FAIR_GROUP_SCHED */ 9909 9907 9910 9908 static void sched_balance_update_blocked_averages(int cpu) 9911 9909 { ··· 10618 10616 return remote; 10619 10617 return all; 10620 10618 } 10621 - #else 10619 + #else /* !CONFIG_NUMA_BALANCING: */ 10622 10620 static inline enum fbq_type fbq_classify_group(struct sg_lb_stats *sgs) 10623 10621 { 10624 10622 return all; ··· 10628 10626 { 10629 10627 return regular; 10630 10628 } 10631 - #endif /* CONFIG_NUMA_BALANCING */ 10629 + #endif /* !CONFIG_NUMA_BALANCING */ 10632 10630 10633 10631 10634 10632 struct sg_lb_stats; ··· 12774 12772 atomic_or(NOHZ_NEWILB_KICK, nohz_flags(this_cpu)); 12775 12773 } 12776 12774 12777 - #else /* !CONFIG_NO_HZ_COMMON */ 12775 + #else /* !CONFIG_NO_HZ_COMMON: */ 12778 12776 static inline void nohz_balancer_kick(struct rq *rq) { } 12779 12777 12780 12778 static inline bool nohz_idle_balance(struct rq *this_rq, enum cpu_idle_type idle) ··· 12783 12781 } 12784 12782 12785 12783 static inline void nohz_newidle_balance(struct rq *this_rq) { } 12786 - #endif /* CONFIG_NO_HZ_COMMON */ 12784 + #endif /* !CONFIG_NO_HZ_COMMON */ 12787 12785 12788 12786 /* 12789 12787 * sched_balance_newidle is called by schedule() if this_cpu is about to become ··· 13078 13076 13079 13077 cfs_rqa = sea->cfs_rq; 13080 13078 cfs_rqb = seb->cfs_rq; 13081 - #else 13079 + #else /* !CONFIG_FAIR_GROUP_SCHED: */ 13082 13080 cfs_rqa = &task_rq(a)->cfs; 13083 13081 cfs_rqb = &task_rq(b)->cfs; 13084 - #endif 13082 + #endif /* !CONFIG_FAIR_GROUP_SCHED */ 13085 13083 13086 13084 /* 13087 13085 * Find delta after normalizing se's vruntime with its cfs_rq's ··· 13105 13103 #endif 13106 13104 return throttled_hierarchy(cfs_rq); 13107 13105 } 13108 - #else 13106 + #else /* !CONFIG_SCHED_CORE: */ 13109 13107 static inline void task_tick_core(struct rq *rq, struct task_struct *curr) {} 13110 - #endif 13108 + #endif /* !CONFIG_SCHED_CORE */ 13111 13109 13112 13110 /* 13113 13111 * scheduler tick hitting a task of our scheduling class. ··· 13201 13199 list_add_leaf_cfs_rq(cfs_rq); 13202 13200 } 13203 13201 } 13204 - #else 13202 + #else /* !CONFIG_FAIR_GROUP_SCHED: */ 13205 13203 static void propagate_entity_cfs_rq(struct sched_entity *se) { } 13206 - #endif 13204 + #endif /* !CONFIG_FAIR_GROUP_SCHED */ 13207 13205 13208 13206 static void detach_entity_cfs_rq(struct sched_entity *se) 13209 13207 { ··· 13739 13737 nohz.next_blocked = jiffies; 13740 13738 zalloc_cpumask_var(&nohz.idle_cpus_mask, GFP_NOWAIT); 13741 13739 #endif 13742 - #endif /* SMP */ 13743 - 13740 + #endif /* CONFIG_SMP */ 13744 13741 }