SCX eBPF macro BPF_FOR_EACH_ITER
The BPF_FOR_EACH_ITER
macro is used as value for it__iter
when calling scx_bpf_dsq_move
or scx_bpf_dsq_move_vtime
from within bpf_for_each
loops.
Definition
#define BPF_FOR_EACH_ITER (&___it)
Usage
Some kfuncs require a pointer to an open coded iterator. When using the bpf_for_each
macro, this iterator is implicitly defined. The BPF_FOR_EACH_ITER
macro takes the address of this implicitly defined iterator so it can be passed.
Example
Loop over all tasks in the shared DSQ and move them to bpf scheduler defined SOME_DSQ
.
struct task_struct *p;
bpf_for_each(scx_dsq, p, SHARED_DSQ, 0) {
scx_bpf_dsq_move_vtime(BPF_FOR_EACH_ITER, p, SOME_DSQ, 0);
}