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/sched.h

- 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-16-mingo@kernel.org

+42 -40
+42 -40
kernel/sched/sched.h
··· 425 425 int nr_burst; 426 426 u64 throttled_time; 427 427 u64 burst_time; 428 - #endif 428 + #endif /* CONFIG_CFS_BANDWIDTH */ 429 429 }; 430 430 431 431 /* Task group related information */ ··· 443 443 /* runqueue "owned" by this group on each CPU */ 444 444 struct cfs_rq **cfs_rq; 445 445 unsigned long shares; 446 - #ifdef CONFIG_SMP 446 + #ifdef CONFIG_SMP 447 447 /* 448 448 * load_avg can be heavily contended at clock tick time, so put 449 449 * it in its own cache-line separated from the fields above which 450 450 * will also be accessed at each tick. 451 451 */ 452 452 atomic_long_t load_avg ____cacheline_aligned; 453 - #endif 454 - #endif 453 + #endif /* CONFIG_SMP */ 454 + #endif /* CONFIG_FAIR_GROUP_SCHED */ 455 455 456 456 #ifdef CONFIG_RT_GROUP_SCHED 457 457 struct sched_rt_entity **rt_se; ··· 532 532 extern int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent); 533 533 extern void online_fair_sched_group(struct task_group *tg); 534 534 extern void unregister_fair_sched_group(struct task_group *tg); 535 - #else 535 + #else /* !CONFIG_FAIR_GROUP_SCHED: */ 536 536 static inline void free_fair_sched_group(struct task_group *tg) { } 537 537 static inline int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent) 538 538 { ··· 540 540 } 541 541 static inline void online_fair_sched_group(struct task_group *tg) { } 542 542 static inline void unregister_fair_sched_group(struct task_group *tg) { } 543 - #endif 543 + #endif /* !CONFIG_FAIR_GROUP_SCHED */ 544 544 545 545 extern void init_tg_cfs_entry(struct task_group *tg, struct cfs_rq *cfs_rq, 546 546 struct sched_entity *se, int cpu, ··· 577 577 #ifdef CONFIG_SMP 578 578 extern void set_task_rq_fair(struct sched_entity *se, 579 579 struct cfs_rq *prev, struct cfs_rq *next); 580 - #else /* !CONFIG_SMP */ 580 + #else /* !CONFIG_SMP: */ 581 581 static inline void set_task_rq_fair(struct sched_entity *se, 582 582 struct cfs_rq *prev, struct cfs_rq *next) { } 583 - #endif /* CONFIG_SMP */ 584 - #else /* !CONFIG_FAIR_GROUP_SCHED */ 583 + #endif /* !CONFIG_SMP */ 584 + #else /* !CONFIG_FAIR_GROUP_SCHED: */ 585 585 static inline int sched_group_set_shares(struct task_group *tg, unsigned long shares) { return 0; } 586 586 static inline int sched_group_set_idle(struct task_group *tg, long idle) { return 0; } 587 - #endif /* CONFIG_FAIR_GROUP_SCHED */ 587 + #endif /* !CONFIG_FAIR_GROUP_SCHED */ 588 588 589 - #else /* CONFIG_CGROUP_SCHED */ 589 + #else /* !CONFIG_CGROUP_SCHED: */ 590 590 591 591 struct cfs_bandwidth { }; 592 592 593 593 static inline bool cfs_task_bw_constrained(struct task_struct *p) { return false; } 594 594 595 - #endif /* CONFIG_CGROUP_SCHED */ 595 + #endif /* !CONFIG_CGROUP_SCHED */ 596 596 597 597 extern void unregister_rt_sched_group(struct task_group *tg); 598 598 extern void free_rt_sched_group(struct task_group *tg); ··· 860 860 * of the leftmost (earliest deadline) element. 861 861 */ 862 862 struct rb_root_cached pushable_dl_tasks_root; 863 - #else 863 + #else /* !CONFIG_SMP: */ 864 864 struct dl_bw dl_bw; 865 - #endif 865 + #endif /* !CONFIG_SMP */ 866 866 /* 867 867 * "Active utilization" for this runqueue: increased when a 868 868 * task wakes up (becomes TASK_RUNNING) and decreased when a ··· 1009 1009 /* These atomics are updated outside of a lock */ 1010 1010 atomic_t rto_loop_next; 1011 1011 atomic_t rto_loop_start; 1012 - #endif 1012 + #endif /* HAVE_RT_PUSH_IPI */ 1013 1013 /* 1014 1014 * The "RT overload" flag: it gets set if a CPU has more than 1015 1015 * one runnable RT task. ··· 1295 1295 unsigned int core_forceidle_seq; 1296 1296 unsigned int core_forceidle_occupation; 1297 1297 u64 core_forceidle_start; 1298 - #endif 1298 + #endif /* CONFIG_SCHED_CORE */ 1299 1299 1300 1300 /* Scratch cpumask to be temporarily used under rq_lock */ 1301 1301 cpumask_var_t scratch_mask; ··· 1314 1314 return cfs_rq->rq; 1315 1315 } 1316 1316 1317 - #else 1317 + #else /* !CONFIG_FAIR_GROUP_SCHED: */ 1318 1318 1319 1319 static inline struct rq *rq_of(struct cfs_rq *cfs_rq) 1320 1320 { 1321 1321 return container_of(cfs_rq, struct rq, cfs); 1322 1322 } 1323 - #endif 1323 + #endif /* !CONFIG_FAIR_GROUP_SCHED */ 1324 1324 1325 1325 static inline int cpu_of(struct rq *rq) 1326 1326 { ··· 1501 1501 } 1502 1502 1503 1503 #endif /* !CONFIG_SCHED_CORE */ 1504 + 1504 1505 #ifdef CONFIG_RT_GROUP_SCHED 1505 1506 # ifdef CONFIG_RT_GROUP_SCHED_DEFAULT_DISABLED 1506 1507 DECLARE_STATIC_KEY_FALSE(rt_group_sched); ··· 1509 1508 { 1510 1509 return static_branch_unlikely(&rt_group_sched); 1511 1510 } 1512 - # else 1511 + # else /* !CONFIG_RT_GROUP_SCHED_DEFAULT_DISABLED: */ 1513 1512 DECLARE_STATIC_KEY_TRUE(rt_group_sched); 1514 1513 static inline bool rt_group_sched_enabled(void) 1515 1514 { 1516 1515 return static_branch_likely(&rt_group_sched); 1517 1516 } 1518 - # endif /* CONFIG_RT_GROUP_SCHED_DEFAULT_DISABLED */ 1519 - #else 1517 + # endif /* !CONFIG_RT_GROUP_SCHED_DEFAULT_DISABLED */ 1518 + #else /* !CONFIG_RT_GROUP_SCHED: */ 1520 1519 # define rt_group_sched_enabled() false 1521 - #endif /* CONFIG_RT_GROUP_SCHED */ 1520 + #endif /* !CONFIG_RT_GROUP_SCHED */ 1522 1521 1523 1522 static inline void lockdep_assert_rq_held(struct rq *rq) 1524 1523 { ··· 1576 1575 __update_idle_core(rq); 1577 1576 } 1578 1577 1579 - #else 1578 + #else /* !CONFIG_SCHED_SMT: */ 1580 1579 static inline void update_idle_core(struct rq *rq) { } 1581 - #endif 1580 + #endif /* !CONFIG_SCHED_SMT */ 1582 1581 1583 1582 #ifdef CONFIG_FAIR_GROUP_SCHED 1584 1583 ··· 1759 1758 WRITE_ONCE(rq->scx.flags, rq->scx.flags & ~SCX_RQ_CLK_VALID); 1760 1759 } 1761 1760 1762 - #else /* !CONFIG_SCHED_CLASS_EXT */ 1761 + #else /* !CONFIG_SCHED_CLASS_EXT: */ 1763 1762 #define scx_enabled() false 1764 1763 #define scx_switched_all() false 1765 1764 ··· 2176 2175 tg = &root_task_group; 2177 2176 p->rt.rt_rq = tg->rt_rq[cpu]; 2178 2177 p->rt.parent = tg->rt_se[cpu]; 2179 - #endif 2178 + #endif /* CONFIG_RT_GROUP_SCHED */ 2180 2179 } 2181 2180 2182 2181 #else /* !CONFIG_CGROUP_SCHED: */ ··· 2202 2201 smp_wmb(); 2203 2202 WRITE_ONCE(task_thread_info(p)->cpu, cpu); 2204 2203 p->wake_cpu = cpu; 2205 - #endif 2204 + #endif /* CONFIG_SMP */ 2206 2205 } 2207 2206 2208 2207 /* ··· 2431 2430 void (*rq_offline)(struct rq *rq); 2432 2431 2433 2432 struct rq *(*find_lock_rq)(struct task_struct *p, struct rq *rq); 2434 - #endif 2433 + #endif /* CONFIG_SMP */ 2435 2434 2436 2435 void (*task_tick)(struct rq *rq, struct task_struct *p, int queued); 2437 2436 void (*task_fork)(struct task_struct *p); ··· 2956 2955 /* 2957 2956 * __sched_core_flip() relies on SMT having cpu-id lock order. 2958 2957 */ 2959 - #endif 2958 + #endif /* CONFIG_SCHED_CORE */ 2960 2959 return rq1->cpu < rq2->cpu; 2961 2960 } 2962 2961 ··· 3147 3146 extern void print_dl_rq(struct seq_file *m, int cpu, struct dl_rq *dl_rq); 3148 3147 3149 3148 extern void resched_latency_warn(int cpu, u64 latency); 3149 + 3150 3150 #ifdef CONFIG_NUMA_BALANCING 3151 3151 extern void show_numa_stats(struct task_struct *p, struct seq_file *m); 3152 3152 extern void ··· 3257 3255 return total; 3258 3256 } 3259 3257 3260 - #else 3258 + #else /* !CONFIG_IRQ_TIME_ACCOUNTING: */ 3261 3259 3262 3260 static inline int irqtime_enabled(void) 3263 3261 { 3264 3262 return 0; 3265 3263 } 3266 3264 3267 - #endif /* CONFIG_IRQ_TIME_ACCOUNTING */ 3265 + #endif /* !CONFIG_IRQ_TIME_ACCOUNTING */ 3268 3266 3269 3267 #ifdef CONFIG_CPU_FREQ 3270 3268 ··· 3358 3356 return READ_ONCE(rq->avg_rt.util_avg); 3359 3357 } 3360 3358 3361 - #else /* !CONFIG_SMP */ 3359 + #else /* !CONFIG_SMP: */ 3362 3360 static inline bool update_other_load_avgs(struct rq *rq) { return false; } 3363 - #endif /* CONFIG_SMP */ 3361 + #endif /* !CONFIG_SMP */ 3364 3362 3365 3363 #ifdef CONFIG_UCLAMP_TASK 3366 3364 ··· 3538 3536 return static_branch_unlikely(&sched_energy_present); 3539 3537 } 3540 3538 3541 - #else /* ! (CONFIG_ENERGY_MODEL && CONFIG_CPU_FREQ_GOV_SCHEDUTIL) */ 3539 + #else /* !(CONFIG_ENERGY_MODEL && CONFIG_CPU_FREQ_GOV_SCHEDUTIL): */ 3542 3540 3543 3541 #define perf_domain_span(pd) NULL 3544 3542 3545 3543 static inline bool sched_energy_enabled(void) { return false; } 3546 3544 3547 - #endif /* CONFIG_ENERGY_MODEL && CONFIG_CPU_FREQ_GOV_SCHEDUTIL */ 3545 + #endif /* !(CONFIG_ENERGY_MODEL && CONFIG_CPU_FREQ_GOV_SCHEDUTIL) */ 3548 3546 3549 3547 #ifdef CONFIG_MEMBARRIER 3550 3548 ··· 3570 3568 WRITE_ONCE(rq->membarrier_state, membarrier_state); 3571 3569 } 3572 3570 3573 - #else /* !CONFIG_MEMBARRIER :*/ 3571 + #else /* !CONFIG_MEMBARRIER: */ 3574 3572 3575 3573 static inline void membarrier_switch_mm(struct rq *rq, 3576 3574 struct mm_struct *prev_mm, ··· 3591 3589 3592 3590 return true; 3593 3591 } 3594 - #endif 3592 + #endif /* CONFIG_SMP */ 3595 3593 3596 3594 extern void swake_up_all_locked(struct swait_queue_head *q); 3597 3595 extern void __prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait); ··· 3911 3909 3912 3910 return false; 3913 3911 } 3914 - #endif 3912 + #endif /* CONFIG_SMP */ 3915 3913 3916 3914 #ifdef CONFIG_RT_MUTEXES 3917 3915 ··· 3955 3953 #ifdef CONFIG_SMP 3956 3954 extern struct balance_callback *splice_balance_callbacks(struct rq *rq); 3957 3955 extern void balance_callbacks(struct rq *rq, struct balance_callback *head); 3958 - #else 3956 + #else /* !CONFIG_SMP: */ 3959 3957 3960 3958 static inline struct balance_callback *splice_balance_callbacks(struct rq *rq) 3961 3959 { ··· 3966 3964 { 3967 3965 } 3968 3966 3969 - #endif 3967 + #endif /* !CONFIG_SMP */ 3970 3968 3971 3969 #ifdef CONFIG_SCHED_CLASS_EXT 3972 3970 /*