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_success_dispatch, s32 cpu, struct task_struct *p) 16 { 17 if (p != NULL) 18 vtime_test = p->scx.dsq_vtime; 19 } 20 21 bool 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 30 SEC(".struct_ops.link") 31 struct 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 }; 37
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.