xref: /linux/tools/testing/selftests/sched_ext/enq_last_no_enq_fails.bpf.c (revision daa9f66fe194f672d2c94d879b6dad7035e03ebe)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * A scheduler that validates the behavior of direct dispatching with a default
4  * select_cpu implementation.
5  *
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>
9  */
10 
11 #include <scx/common.bpf.h>
12 
13 char _license[] SEC("license") = "GPL";
14 
15 u32 exit_kind;
16 
BPF_STRUCT_OPS_SLEEPABLE(enq_last_no_enq_fails_exit,struct scx_exit_info * info)17 void BPF_STRUCT_OPS_SLEEPABLE(enq_last_no_enq_fails_exit, struct scx_exit_info *info)
18 {
19 	exit_kind = info->kind;
20 }
21 
22 SEC(".struct_ops.link")
23 struct sched_ext_ops enq_last_no_enq_fails_ops = {
24 	.name			= "enq_last_no_enq_fails",
25 	/* Need to define ops.enqueue() with SCX_OPS_ENQ_LAST */
26 	.flags			= SCX_OPS_ENQ_LAST,
27 	.exit			= (void *) enq_last_no_enq_fails_exit,
28 	.timeout_ms		= 1000U,
29 };
30