Skip to content

KFunc __scx_bpf_dsq_insert_vtime

v6.19

This function inserts a task into the vtime priority queue of a DSQ.

Definition

Wrapper kfunc that takes arguments via struct to work around the 5 argument limit for BPF functions. BPF programs should use scx_bpf_dsq_insert_vtime which is provided as an inline wrapper in common.bpf.h.

Insert p into the vtime priority queue of the DSQ identified by args->dsq_id. Tasks queued into the priority queue are ordered by args->vtime. All other aspects are identical to scx_bpf_dsq_insert.

args->vtime ordering is according to time_before64() which considers wrapping. A numerically larger vtime may indicate an earlier position in the ordering and vice-versa.

A DSQ can only be used as a FIFO or priority queue at any given time and this function must not be called on a DSQ which already has one or more FIFO tasks queued and vice-versa. Also, the built-in DSQs (SCX_DSQ_LOCAL and SCX_DSQ_GLOBAL) cannot be used as priority queues.

Parameters

p: task_struct to insert

args: struct containing the rest of the arguments

args->dsq_id: DSQ to insert into

args->slice: duration p can run for in nanoseconds, 0 to keep the current value

args->vtime: p's ordering inside the vtime-sorted queue of the target DSQ

args->enq_flags: Bitfield of flags, see enum scx_enq_flags for valid values.

returns

Returns true on successful insertion, false on failure. On the root scheduler, false return triggers scheduler abort and the caller doesn't need to check the return value.

Signature

bool __scx_bpf_dsq_insert_vtime(struct task_struct *p, struct scx_bpf_dsq_insert_vtime_args *args)

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