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 * A scheduler that validates the behavior of direct dispatching with a default
 4 * select_cpu implementation.
 5 *
 6 * Copyright (c) 2023 Meta Platforms, Inc. and affiliates.
 7 * Copyright (c) 2023 David Vernet <dvernet@meta.com>
 8 * Copyright (c) 2023 Tejun Heo <tj@kernel.org>
 9 */
10
11#include <scx/common.bpf.h>
12
13char _license[] SEC("license") = "GPL";
14
15UEI_DEFINE(uei);
16
17s32 BPF_STRUCT_OPS(select_cpu_dispatch_dbl_dsp_select_cpu, struct task_struct *p,
18		   s32 prev_cpu, u64 wake_flags)
19{
20	/* Dispatching twice in a row is disallowed. */
21	scx_bpf_dsq_insert(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, 0);
22	scx_bpf_dsq_insert(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, 0);
23
24	return prev_cpu;
25}
26
27void BPF_STRUCT_OPS(select_cpu_dispatch_dbl_dsp_exit, struct scx_exit_info *ei)
28{
29	UEI_RECORD(uei, ei);
30}
31
32SEC(".struct_ops.link")
33struct sched_ext_ops select_cpu_dispatch_dbl_dsp_ops = {
34	.select_cpu		= (void *) select_cpu_dispatch_dbl_dsp_select_cpu,
35	.exit			= (void *) select_cpu_dispatch_dbl_dsp_exit,
36	.name			= "select_cpu_dispatch_dbl_dsp",
37	.timeout_ms		= 1000U,
38};