KFunc scx_bpf_dsq_peek
Lock-less peek at the first element.
Definition
Read the first element in the DSQ. This is semantically equivalent to using the DSQ iterator, but is lock-free. Of course, like any lock-less operation, this provides only a point-in-time snapshot, and the contents may change by the time any subsequent locking operation reads the queue.
Parameters
dsq_id: DSQ to examine.
Returns
The pointer, or NULL indicates an empty queue OR internal error.
Signature
struct task_struct *scx_bpf_dsq_peek(u64 dsq_id)
Note
This kfunc is RCU protected. This means that the kfunc can be called from RCU read-side critical section.
If a program isn't called from RCU read-side critical section, such as sleepable programs, the
bpf_rcu_read_lock and
bpf_rcu_read_unlock to protect the calls to such KFuncs.
Note
The pointer returned by the kfunc may be NULL. Hence, it forces the user to do a NULL check on the pointer returned from the kfunc before making use of it (dereferencing or passing to another helper).
Usage
Docs could be improved
This part of the docs is incomplete, contributions are very welcome
Program types
The following program types can make use of this kfunc:
Example
Docs could be improved
This part of the docs is incomplete, contributions are very welcome