1a5db7817SDavid Vernet /* SPDX-License-Identifier: GPL-2.0 */
2a5db7817SDavid Vernet /*
3a5db7817SDavid Vernet * Copyright (c) 2024 Meta Platforms, Inc. and affiliates.
4a5db7817SDavid Vernet */
5a5db7817SDavid Vernet
6a5db7817SDavid Vernet #include <scx/common.bpf.h>
7a5db7817SDavid Vernet
8a5db7817SDavid Vernet char _license[] SEC("license") = "GPL";
9a5db7817SDavid Vernet
10a5db7817SDavid Vernet u64 vtime_test;
11a5db7817SDavid Vernet
BPF_STRUCT_OPS(maybe_null_running,struct task_struct * p)12a5db7817SDavid Vernet void BPF_STRUCT_OPS(maybe_null_running, struct task_struct *p)
13a5db7817SDavid Vernet {}
14a5db7817SDavid Vernet
BPF_STRUCT_OPS(maybe_null_fail_yield,struct task_struct * from,struct task_struct * to)15a5db7817SDavid Vernet bool BPF_STRUCT_OPS(maybe_null_fail_yield, struct task_struct *from,
16a5db7817SDavid Vernet struct task_struct *to)
17a5db7817SDavid Vernet {
18a5db7817SDavid Vernet bpf_printk("Yielding to %s[%d]", to->comm, to->pid);
19a5db7817SDavid Vernet
20a5db7817SDavid Vernet return false;
21a5db7817SDavid Vernet }
22a5db7817SDavid Vernet
23a5db7817SDavid Vernet SEC(".struct_ops.link")
24a5db7817SDavid Vernet struct sched_ext_ops maybe_null_fail = {
25*4f7f4170SVishal Chourasia .yield = (void *) maybe_null_fail_yield,
26*4f7f4170SVishal Chourasia .enable = (void *) maybe_null_running,
27a5db7817SDavid Vernet .name = "maybe_null_fail_yield",
28a5db7817SDavid Vernet };
29