xref: /linux/tools/testing/selftests/sched_ext/maybe_null_fail_dsp.bpf.c (revision daa9f66fe194f672d2c94d879b6dad7035e03ebe)
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 
BPF_STRUCT_OPS(maybe_null_running,struct task_struct * p)12 void BPF_STRUCT_OPS(maybe_null_running, struct task_struct *p)
13 {}
14 
BPF_STRUCT_OPS(maybe_null_fail_dispatch,s32 cpu,struct task_struct * p)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               = (void *) maybe_null_fail_dispatch,
23 	.enable			= (void *) maybe_null_running,
24 	.name			= "maybe_null_fail_dispatch",
25 };
26