1 /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* 3 * BPF extensible scheduler class: Documentati 4 * 5 * Copyright (c) 2022 Meta Platforms, Inc. and 6 * Copyright (c) 2022 Tejun Heo <tj@kernel.org 7 * Copyright (c) 2022 David Vernet <dvernet@me 8 */ 9 #ifdef CONFIG_SCHED_CLASS_EXT 10 11 void scx_tick(struct rq *rq); 12 void init_scx_entity(struct sched_ext_entity * 13 void scx_pre_fork(struct task_struct *p); 14 int scx_fork(struct task_struct *p); 15 void scx_post_fork(struct task_struct *p); 16 void scx_cancel_fork(struct task_struct *p); 17 bool scx_can_stop_tick(struct rq *rq); 18 void scx_rq_activate(struct rq *rq); 19 void scx_rq_deactivate(struct rq *rq); 20 int scx_check_setscheduler(struct task_struct 21 bool task_should_scx(int policy); 22 void init_sched_ext_class(void); 23 24 static inline u32 scx_cpuperf_target(s32 cpu) 25 { 26 if (scx_enabled()) 27 return cpu_rq(cpu)->scx.cpuper 28 else 29 return 0; 30 } 31 32 static inline bool task_on_scx(const struct ta 33 { 34 return scx_enabled() && p->sched_class 35 } 36 37 #ifdef CONFIG_SCHED_CORE 38 bool scx_prio_less(const struct task_struct *a 39 bool in_fi); 40 #endif 41 42 #else /* CONFIG_SCHED_CLASS_EXT */ 43 44 static inline void scx_tick(struct rq *rq) {} 45 static inline void scx_pre_fork(struct task_st 46 static inline int scx_fork(struct task_struct 47 static inline void scx_post_fork(struct task_s 48 static inline void scx_cancel_fork(struct task 49 static inline u32 scx_cpuperf_target(s32 cpu) 50 static inline bool scx_can_stop_tick(struct rq 51 static inline void scx_rq_activate(struct rq * 52 static inline void scx_rq_deactivate(struct rq 53 static inline int scx_check_setscheduler(struc 54 static inline bool task_on_scx(const struct ta 55 static inline void init_sched_ext_class(void) 56 57 #endif /* CONFIG_SCHED_CLASS_EXT */ 58 59 #if defined(CONFIG_SCHED_CLASS_EXT) && defined 60 void __scx_update_idle(struct rq *rq, bool idl 61 62 static inline void scx_update_idle(struct rq * 63 { 64 if (scx_enabled()) 65 __scx_update_idle(rq, idle); 66 } 67 #else 68 static inline void scx_update_idle(struct rq * 69 #endif 70 71 #ifdef CONFIG_CGROUP_SCHED 72 #ifdef CONFIG_EXT_GROUP_SCHED 73 int scx_tg_online(struct task_group *tg); 74 void scx_tg_offline(struct task_group *tg); 75 int scx_cgroup_can_attach(struct cgroup_taskse 76 void scx_move_task(struct task_struct *p); 77 void scx_cgroup_finish_attach(void); 78 void scx_cgroup_cancel_attach(struct cgroup_ta 79 void scx_group_set_weight(struct task_group *t 80 void scx_group_set_idle(struct task_group *tg, 81 #else /* CONFIG_EXT_GROUP_SCHED */ 82 static inline int scx_tg_online(struct task_gr 83 static inline void scx_tg_offline(struct task_ 84 static inline int scx_cgroup_can_attach(struct 85 static inline void scx_move_task(struct task_s 86 static inline void scx_cgroup_finish_attach(vo 87 static inline void scx_cgroup_cancel_attach(st 88 static inline void scx_group_set_weight(struct 89 static inline void scx_group_set_idle(struct t 90 #endif /* CONFIG_EXT_GROUP_SCHED */ 91 #endif /* CONFIG_CGROUP_SCHED */ 92
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.