xref: /linux/tools/testing/selftests/sched_ext/maybe_null_fail_dsp.bpf.c (revision c7546e2c3cb739a3c1a2f5acaf9bb629d401afe5)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (c) 2024 Meta Platforms, Inc. and affiliates.
4  */
5 
6 #include <scx/common.bpf.h>
7 
8 char _license[] SEC("license") = "GPL";
9 
10 u64 vtime_test;
11 
12 void BPF_STRUCT_OPS(maybe_null_running, struct task_struct *p)
13 {}
14 
15 void BPF_STRUCT_OPS(maybe_null_fail_dispatch, s32 cpu, struct task_struct *p)
16 {
17 	vtime_test = p->scx.dsq_vtime;
18 }
19 
20 SEC(".struct_ops.link")
21 struct sched_ext_ops maybe_null_fail = {
22 	.dispatch               = maybe_null_fail_dispatch,
23 	.enable			= maybe_null_running,
24 	.name			= "maybe_null_fail_dispatch",
25 };
26