Skip to content

KFunc scx_bpf_locked_rq

v6.18

Return the run queue currently locked by SCX

Definition

Returns

Returns the run queue if a run queue lock is currently held by SCX. Otherwise emits an error and returns NULL.

Signature

struct rq *scx_bpf_locked_rq()

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

Most fields in scx_bpf_cpu_rq assume that its rq_lock is held. Furthermore they become meaningless without run queue lock, too. Make a safer version of scx_bpf_cpu_rq that only returns a run queue if we hold run queue lock of that run queue.

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