Skip to content

Commit 353656e

Browse files
arighihtejun
authored andcommitted
sched_ext: idle: Make local functions static in ext_idle.c
Functions that are only used within ext_idle.c can be marked as static to limit their scope. No functional changes. Signed-off-by: Andrea Righi <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent c68ea82 commit 353656e

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

kernel/sched/ext_idle.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static int scx_cpu_node_if_enabled(int cpu)
7575
return cpu_to_node(cpu);
7676
}
7777

78-
bool scx_idle_test_and_clear_cpu(int cpu)
78+
static bool scx_idle_test_and_clear_cpu(int cpu)
7979
{
8080
int node = scx_cpu_node_if_enabled(cpu);
8181
struct cpumask *idle_cpus = idle_cpumask(node)->cpu;
@@ -198,7 +198,7 @@ pick_idle_cpu_from_online_nodes(const struct cpumask *cpus_allowed, int node, u6
198198
/*
199199
* Find an idle CPU in the system, starting from @node.
200200
*/
201-
s32 scx_pick_idle_cpu(const struct cpumask *cpus_allowed, int node, u64 flags)
201+
static s32 scx_pick_idle_cpu(const struct cpumask *cpus_allowed, int node, u64 flags)
202202
{
203203
s32 cpu;
204204

@@ -794,6 +794,16 @@ static void reset_idle_masks(struct sched_ext_ops *ops)
794794
cpumask_and(idle_cpumask(node)->smt, cpu_online_mask, node_mask);
795795
}
796796
}
797+
#else /* !CONFIG_SMP */
798+
static bool scx_idle_test_and_clear_cpu(int cpu)
799+
{
800+
return -EBUSY;
801+
}
802+
803+
static s32 scx_pick_idle_cpu(const struct cpumask *cpus_allowed, int node, u64 flags)
804+
{
805+
return -EBUSY;
806+
}
797807
#endif /* CONFIG_SMP */
798808

799809
void scx_idle_enable(struct sched_ext_ops *ops)
@@ -860,8 +870,8 @@ static bool check_builtin_idle_enabled(void)
860870
return false;
861871
}
862872

863-
s32 select_cpu_from_kfunc(struct task_struct *p, s32 prev_cpu, u64 wake_flags,
864-
const struct cpumask *allowed, u64 flags)
873+
static s32 select_cpu_from_kfunc(struct task_struct *p, s32 prev_cpu, u64 wake_flags,
874+
const struct cpumask *allowed, u64 flags)
865875
{
866876
struct rq *rq;
867877
struct rq_flags rf;
@@ -1121,10 +1131,10 @@ __bpf_kfunc bool scx_bpf_test_and_clear_cpu_idle(s32 cpu)
11211131
if (!check_builtin_idle_enabled())
11221132
return false;
11231133

1124-
if (kf_cpu_valid(cpu, NULL))
1125-
return scx_idle_test_and_clear_cpu(cpu);
1126-
else
1134+
if (!kf_cpu_valid(cpu, NULL))
11271135
return false;
1136+
1137+
return scx_idle_test_and_clear_cpu(cpu);
11281138
}
11291139

11301140
/**

kernel/sched/ext_idle.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,9 @@ struct sched_ext_ops;
1515
#ifdef CONFIG_SMP
1616
void scx_idle_update_selcpu_topology(struct sched_ext_ops *ops);
1717
void scx_idle_init_masks(void);
18-
bool scx_idle_test_and_clear_cpu(int cpu);
19-
s32 scx_pick_idle_cpu(const struct cpumask *cpus_allowed, int node, u64 flags);
2018
#else /* !CONFIG_SMP */
2119
static inline void scx_idle_update_selcpu_topology(struct sched_ext_ops *ops) {}
2220
static inline void scx_idle_init_masks(void) {}
23-
static inline bool scx_idle_test_and_clear_cpu(int cpu) { return false; }
24-
static inline s32 scx_pick_idle_cpu(const struct cpumask *cpus_allowed, int node, u64 flags)
25-
{
26-
return -EBUSY;
27-
}
2821
#endif /* CONFIG_SMP */
2922

3023
s32 scx_select_cpu_dfl(struct task_struct *p, s32 prev_cpu, u64 wake_flags,

0 commit comments

Comments
 (0)