~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/kernel/sched/ext.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * BPF extensible scheduler class: Documentation/scheduler/sched-ext.rst
  4  *
  5  * Copyright (c) 2022 Meta Platforms, Inc. and affiliates.
  6  * Copyright (c) 2022 Tejun Heo <tj@kernel.org>
  7  * Copyright (c) 2022 David Vernet <dvernet@meta.com>
  8  */
  9 #ifdef CONFIG_SCHED_CLASS_EXT
 10 
 11 void scx_tick(struct rq *rq);
 12 void init_scx_entity(struct sched_ext_entity *scx);
 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 *p, int policy);
 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.cpuperf_target;
 28         else
 29                 return 0;
 30 }
 31 
 32 static inline bool task_on_scx(const struct task_struct *p)
 33 {
 34         return scx_enabled() && p->sched_class == &ext_sched_class;
 35 }
 36 
 37 #ifdef CONFIG_SCHED_CORE
 38 bool scx_prio_less(const struct task_struct *a, const struct task_struct *b,
 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_struct *p) {}
 46 static inline int scx_fork(struct task_struct *p) { return 0; }
 47 static inline void scx_post_fork(struct task_struct *p) {}
 48 static inline void scx_cancel_fork(struct task_struct *p) {}
 49 static inline u32 scx_cpuperf_target(s32 cpu) { return 0; }
 50 static inline bool scx_can_stop_tick(struct rq *rq) { return true; }
 51 static inline void scx_rq_activate(struct rq *rq) {}
 52 static inline void scx_rq_deactivate(struct rq *rq) {}
 53 static inline int scx_check_setscheduler(struct task_struct *p, int policy) { return 0; }
 54 static inline bool task_on_scx(const struct task_struct *p) { return false; }
 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(CONFIG_SMP)
 60 void __scx_update_idle(struct rq *rq, bool idle);
 61 
 62 static inline void scx_update_idle(struct rq *rq, bool idle)
 63 {
 64         if (scx_enabled())
 65                 __scx_update_idle(rq, idle);
 66 }
 67 #else
 68 static inline void scx_update_idle(struct rq *rq, bool idle) {}
 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_taskset *tset);
 76 void scx_move_task(struct task_struct *p);
 77 void scx_cgroup_finish_attach(void);
 78 void scx_cgroup_cancel_attach(struct cgroup_taskset *tset);
 79 void scx_group_set_weight(struct task_group *tg, unsigned long cgrp_weight);
 80 void scx_group_set_idle(struct task_group *tg, bool idle);
 81 #else   /* CONFIG_EXT_GROUP_SCHED */
 82 static inline int scx_tg_online(struct task_group *tg) { return 0; }
 83 static inline void scx_tg_offline(struct task_group *tg) {}
 84 static inline int scx_cgroup_can_attach(struct cgroup_taskset *tset) { return 0; }
 85 static inline void scx_move_task(struct task_struct *p) {}
 86 static inline void scx_cgroup_finish_attach(void) {}
 87 static inline void scx_cgroup_cancel_attach(struct cgroup_taskset *tset) {}
 88 static inline void scx_group_set_weight(struct task_group *tg, unsigned long cgrp_weight) {}
 89 static inline void scx_group_set_idle(struct task_group *tg, bool idle) {}
 90 #endif  /* CONFIG_EXT_GROUP_SCHED */
 91 #endif  /* CONFIG_CGROUP_SCHED */
 92 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php