tools/testing/selftests/sched_ext/cyclic_kick_wait.bpf.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/sched_ext/cyclic_kick_wait.bpf.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/sched_ext/cyclic_kick_wait.bpf.c- Extension
.c- Size
- 1572 bytes
- Lines
- 69
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
scx/common.bpf.h
Detected Declarations
function target_cpufunction BPF_STRUCT_OPSfunction BPF_STRUCT_OPS
Annotated Snippet
#include <scx/common.bpf.h>
char _license[] SEC("license") = "GPL";
const volatile s32 test_cpu_a;
const volatile s32 test_cpu_b;
const volatile s32 test_cpu_c;
u64 nr_enqueues;
u64 nr_wait_kicks;
UEI_DEFINE(uei);
static s32 target_cpu(s32 cpu)
{
if (cpu == test_cpu_a)
return test_cpu_b;
if (cpu == test_cpu_b)
return test_cpu_c;
if (cpu == test_cpu_c)
return test_cpu_a;
return -1;
}
void BPF_STRUCT_OPS(cyclic_kick_wait_enqueue, struct task_struct *p,
u64 enq_flags)
{
s32 this_cpu = bpf_get_smp_processor_id();
s32 tgt;
__sync_fetch_and_add(&nr_enqueues, 1);
if (p->flags & PF_KTHREAD) {
scx_bpf_dsq_insert(p, SCX_DSQ_LOCAL, SCX_SLICE_INF,
enq_flags | SCX_ENQ_PREEMPT);
return;
}
scx_bpf_dsq_insert(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, enq_flags);
tgt = target_cpu(this_cpu);
if (tgt < 0 || tgt == this_cpu)
return;
__sync_fetch_and_add(&nr_wait_kicks, 1);
scx_bpf_kick_cpu(tgt, SCX_KICK_WAIT);
}
void BPF_STRUCT_OPS(cyclic_kick_wait_exit, struct scx_exit_info *ei)
{
UEI_RECORD(uei, ei);
}
SEC(".struct_ops.link")
struct sched_ext_ops cyclic_kick_wait_ops = {
.enqueue = cyclic_kick_wait_enqueue,
.exit = cyclic_kick_wait_exit,
.name = "cyclic_kick_wait",
.timeout_ms = 1000U,
};
Annotation
- Immediate include surface: `scx/common.bpf.h`.
- Detected declarations: `function target_cpu`, `function BPF_STRUCT_OPS`, `function BPF_STRUCT_OPS`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.