mirror-linux/tools/testing/selftests/sched_ext
Ryan Newton 5aff3b3199 sched_ext: Add a selftest for scx_bpf_dsq_peek
This commit adds two tests. The first is the most basic unit test:
make sure an empty queue peeks as empty, and when we put one element
in the queue, make sure peek returns that element.

However, even this simple test is a little complicated by the different
behavior of scx_bpf_dsq_insert in different calling contexts:
 - insert is for direct dispatch in enqueue
 - insert is delayed when called from select_cpu

In this case we split the insert and the peek that verifies the
result between enqueue/dispatch.

Note: An alternative would be to call `scx_bpf_dsq_move_to_local` on an
empty queue, which in turn calls `flush_dispatch_buf`, in order to flush
the buffered insert. Unfortunately, this is not viable within the
enqueue path, as it attempts a voluntary context switch within an RCU
read-side critical section.

The second test is a stress test that performs many peeks on all DSQs
and records the observed tasks.

Signed-off-by: Ryan Newton <newton@meta.com>
Reviewed-by: Christian Loehle <christian.loehle@arm.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
2025-10-15 06:46:36 -10:00
..
.gitignore
Makefile sched_ext: Add a selftest for scx_bpf_dsq_peek 2025-10-15 06:46:36 -10:00
allowed_cpus.bpf.c selftests/sched_ext: Add test for scx_bpf_select_cpu_and() via test_run 2025-05-20 10:24:17 -10:00
allowed_cpus.c selftests/sched_ext: Add test for scx_bpf_select_cpu_and() via test_run 2025-05-20 10:24:17 -10:00
config sched/debug: Remove CONFIG_SCHED_DEBUG from self-test config files 2025-03-19 22:23:24 +01:00
create_dsq.bpf.c
create_dsq.c selftests/sched_ext: Fix enum resolution 2025-01-24 08:09:52 -10:00
ddsp_bogus_dsq_fail.bpf.c
ddsp_bogus_dsq_fail.c selftests/sched_ext: Fix enum resolution 2025-01-24 08:09:52 -10:00
ddsp_vtimelocal_fail.bpf.c
ddsp_vtimelocal_fail.c selftests/sched_ext: Fix enum resolution 2025-01-24 08:09:52 -10:00
dsp_local_on.bpf.c sched_ext: selftests/dsp_local_on: Fix selftest on UP systems 2025-01-27 09:00:09 -10:00
dsp_local_on.c selftests/sched_ext: Fix enum resolution 2025-01-24 08:09:52 -10:00
enq_last_no_enq_fails.bpf.c
enq_last_no_enq_fails.c selftests/sched_ext: Fix enum resolution 2025-01-24 08:09:52 -10:00
enq_select_cpu.bpf.c selftests/sched_ext: Update test enq_select_cpu_fails 2025-05-21 07:35:58 -10:00
enq_select_cpu.c selftests/sched_ext: Update test enq_select_cpu_fails 2025-05-21 07:35:58 -10:00
exit.bpf.c
exit.c selftests/sched_ext: Fix exit selftest hang on UP 2025-07-03 06:44:13 -10:00
exit_test.h
hotplug.bpf.c
hotplug.c selftests/sched_ext: Remove duplicate sched.h header 2025-08-11 08:24:08 -10:00
hotplug_test.h
init_enable_count.bpf.c
init_enable_count.c sched_ext: selftests: Fix grammar in tests description 2025-02-13 06:46:22 -10:00
maximal.bpf.c sched_ext: Add support for cgroup bandwidth control interface 2025-06-20 17:03:51 -10:00
maximal.c selftests/sched_ext: Fix enum resolution 2025-01-24 08:09:52 -10:00
maybe_null.bpf.c
maybe_null.c sched_ext: selftests: Fix grammar in tests description 2025-02-13 06:46:22 -10:00
maybe_null_fail_dsp.bpf.c
maybe_null_fail_yld.bpf.c
minimal.bpf.c
minimal.c selftests/sched_ext: Fix enum resolution 2025-01-24 08:09:52 -10:00
numa.bpf.c selftests/sched_ext: Add NUMA-aware scheduler test 2025-02-26 08:49:02 -10:00
numa.c selftests/sched_ext: Add NUMA-aware scheduler test 2025-02-26 08:49:02 -10:00
peek_dsq.bpf.c sched_ext: Add a selftest for scx_bpf_dsq_peek 2025-10-15 06:46:36 -10:00
peek_dsq.c sched_ext: Add a selftest for scx_bpf_dsq_peek 2025-10-15 06:46:36 -10:00
prog_run.bpf.c
prog_run.c selftests/sched_ext: Fix enum resolution 2025-01-24 08:09:52 -10:00
reload_loop.c selftests/sched_ext: Fix enum resolution 2025-01-24 08:09:52 -10:00
runner.c
scx_test.h
select_cpu_dfl.bpf.c
select_cpu_dfl.c selftests/sched_ext: Fix enum resolution 2025-01-24 08:09:52 -10:00
select_cpu_dfl_nodispatch.bpf.c
select_cpu_dfl_nodispatch.c selftests/sched_ext: Fix enum resolution 2025-01-24 08:09:52 -10:00
select_cpu_dispatch.bpf.c
select_cpu_dispatch.c selftests/sched_ext: Fix enum resolution 2025-01-24 08:09:52 -10:00
select_cpu_dispatch_bad_dsq.bpf.c
select_cpu_dispatch_bad_dsq.c selftests/sched_ext: Fix enum resolution 2025-01-24 08:09:52 -10:00
select_cpu_dispatch_dbl_dsp.bpf.c
select_cpu_dispatch_dbl_dsp.c selftests/sched_ext: Fix enum resolution 2025-01-24 08:09:52 -10:00
select_cpu_vtime.bpf.c
select_cpu_vtime.c selftests/sched_ext: Fix enum resolution 2025-01-24 08:09:52 -10:00
test_example.c
util.c
util.h