Skip to content

Commit 6ab228e

Browse files
committed
sched_ext: Minor cleanups in kernel/sched/ext.h
- scx_ops_cpu_preempt is only used in kernel/sched/ext.c and doesn't need to be global. Make it static. - Relocate task_on_scx() so that the inline functions are located together. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: David Vernet <void@manifault.com>
1 parent 9f391f9 commit 6ab228e

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

kernel/sched/ext.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ static bool scx_warned_zero_slice;
771771

772772
static DEFINE_STATIC_KEY_FALSE(scx_ops_enq_last);
773773
static DEFINE_STATIC_KEY_FALSE(scx_ops_enq_exiting);
774-
DEFINE_STATIC_KEY_FALSE(scx_ops_cpu_preempt);
774+
static DEFINE_STATIC_KEY_FALSE(scx_ops_cpu_preempt);
775775
static DEFINE_STATIC_KEY_FALSE(scx_builtin_idle_enabled);
776776

777777
struct static_key_false scx_has_op[SCX_OPI_END] =

kernel/sched/ext.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@ DECLARE_STATIC_KEY_FALSE(__scx_switched_all);
2626
#define scx_enabled() static_branch_unlikely(&__scx_ops_enabled)
2727
#define scx_switched_all() static_branch_unlikely(&__scx_switched_all)
2828

29-
DECLARE_STATIC_KEY_FALSE(scx_ops_cpu_preempt);
30-
31-
static inline bool task_on_scx(const struct task_struct *p)
32-
{
33-
return scx_enabled() && p->sched_class == &ext_sched_class;
34-
}
35-
3629
void scx_tick(struct rq *rq);
3730
void init_scx_entity(struct sched_ext_entity *scx);
3831
void scx_pre_fork(struct task_struct *p);
@@ -54,6 +47,11 @@ static inline u32 scx_cpuperf_target(s32 cpu)
5447
return 0;
5548
}
5649

50+
static inline bool task_on_scx(const struct task_struct *p)
51+
{
52+
return scx_enabled() && p->sched_class == &ext_sched_class;
53+
}
54+
5755
static inline const struct sched_class *next_active_class(const struct sched_class *class)
5856
{
5957
class++;

0 commit comments

Comments
 (0)