1 /* SPDX-License-Identifier: GPL-2.0 */
3 * A scheduler that validates the behavior of direct dispatching with a default
4 * select_cpu implementation.
6 * Copyright (c) 2023 Meta Platforms, Inc. and affiliates.
7 * Copyright (c) 2023 David Vernet <dvernet@meta.com>
8 * Copyright (c) 2023 Tejun Heo <tj@kernel.org>
11 #include <scx/common.bpf.h>
13 char _license
[] SEC("license") = "GPL";
17 s32
BPF_STRUCT_OPS(select_cpu_dispatch_dbl_dsp_select_cpu
, struct task_struct
*p
,
18 s32 prev_cpu
, u64 wake_flags
)
20 /* Dispatching twice in a row is disallowed. */
21 scx_bpf_dispatch(p
, SCX_DSQ_GLOBAL
, SCX_SLICE_DFL
, 0);
22 scx_bpf_dispatch(p
, SCX_DSQ_GLOBAL
, SCX_SLICE_DFL
, 0);
27 void BPF_STRUCT_OPS(select_cpu_dispatch_dbl_dsp_exit
, struct scx_exit_info
*ei
)
32 SEC(".struct_ops.link")
33 struct sched_ext_ops select_cpu_dispatch_dbl_dsp_ops
= {
34 .select_cpu
= (void *) select_cpu_dispatch_dbl_dsp_select_cpu
,
35 .exit
= (void *) select_cpu_dispatch_dbl_dsp_exit
,
36 .name
= "select_cpu_dispatch_dbl_dsp",