Skip to content

Commit b8f6142

Browse files
Byte-Labhtejun
authored andcommitted
scx: Fix maximal BPF selftest prog
maximal.bpf.c is still dispatching to and consuming from SCX_DSQ_GLOBAL. Let's have it use its own DSQ to avoid any runtime errors. Signed-off-by: David Vernet <void@manifault.com> Tested-by: Andrea Righi <arighi@nvidia.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent f24d192 commit b8f6142

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tools/testing/selftests/sched_ext/maximal.bpf.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
char _license[] SEC("license") = "GPL";
1414

15+
#define DSQ_ID 0
16+
1517
s32 BPF_STRUCT_OPS(maximal_select_cpu, struct task_struct *p, s32 prev_cpu,
1618
u64 wake_flags)
1719
{
@@ -20,15 +22,15 @@ s32 BPF_STRUCT_OPS(maximal_select_cpu, struct task_struct *p, s32 prev_cpu,
2022

2123
void BPF_STRUCT_OPS(maximal_enqueue, struct task_struct *p, u64 enq_flags)
2224
{
23-
scx_bpf_dsq_insert(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, enq_flags);
25+
scx_bpf_dsq_insert(p, DSQ_ID, SCX_SLICE_DFL, enq_flags);
2426
}
2527

2628
void BPF_STRUCT_OPS(maximal_dequeue, struct task_struct *p, u64 deq_flags)
2729
{}
2830

2931
void BPF_STRUCT_OPS(maximal_dispatch, s32 cpu, struct task_struct *prev)
3032
{
31-
scx_bpf_dsq_move_to_local(SCX_DSQ_GLOBAL);
33+
scx_bpf_dsq_move_to_local(DSQ_ID);
3234
}
3335

3436
void BPF_STRUCT_OPS(maximal_runnable, struct task_struct *p, u64 enq_flags)
@@ -123,7 +125,7 @@ void BPF_STRUCT_OPS(maximal_cgroup_set_weight, struct cgroup *cgrp, u32 weight)
123125

124126
s32 BPF_STRUCT_OPS_SLEEPABLE(maximal_init)
125127
{
126-
return 0;
128+
return scx_bpf_create_dsq(DSQ_ID, -1);
127129
}
128130

129131
void BPF_STRUCT_OPS(maximal_exit, struct scx_exit_info *info)

0 commit comments

Comments
 (0)