Linux Audio

Check our new training course

Loading...
Note: File does not exist in v4.10.11.
 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
 8char _license[] SEC("license") = "GPL";
 9
10u64 vtime_test;
11
12void BPF_STRUCT_OPS(maybe_null_running, struct task_struct *p)
13{}
14
15void BPF_STRUCT_OPS(maybe_null_success_dispatch, s32 cpu, struct task_struct *p)
16{
17	if (p != NULL)
18		vtime_test = p->scx.dsq_vtime;
19}
20
21bool BPF_STRUCT_OPS(maybe_null_success_yield, struct task_struct *from,
22		    struct task_struct *to)
23{
24	if (to)
25		bpf_printk("Yielding to %s[%d]", to->comm, to->pid);
26
27	return false;
28}
29
30SEC(".struct_ops.link")
31struct sched_ext_ops maybe_null_success = {
32	.dispatch               = (void *) maybe_null_success_dispatch,
33	.yield			= (void *) maybe_null_success_yield,
34	.enable			= (void *) maybe_null_running,
35	.name			= "minimal",
36};