Skip to content

KFunc scx_bpf_dsq_move

v6.13

This function moves a task from DSQ iteration to a DSQ.

Definition

Transfer p which is on the DSQ currently iterated by it__iter to the DSQ specified by dsq_id. All DSQs - local DSQs, global DSQ and user DSQs - can be the destination.

For the transfer to be successful, p must still be on the DSQ and have been queued before the DSQ iteration started. This function doesn't care whether p was obtained from the DSQ iteration. p just has to be on the DSQ and have been queued before the iteration started.

p's slice is kept by default. Use scx_bpf_dsq_move_set_slice to update.

Can be called from ops.dispatch() or any BPF context which doesn't hold a rq lock (e.g. BPF timers or BPF_PROG_TYPE_SYSCALL programs).

Parameters

it__iter: DSQ iterator in progress

p: task to transfer

dsq_id: DSQ to move p to

enq_flags: SCX_ENQ_*

Flags

SCX_ENQ_WAKEUP: Task just became runnable

SCX_ENQ_HEAD: Place at front of queue (tail if not specified)

SCX_ENQ_CPU_SELECTED: ->select_task_rq() was called

SCX_ENQ_PREEMPT: Set the following to trigger preemption when calling scx_bpf_dsq_insert with a local dsq as the target. The slice of the current task is cleared to zero and the CPU is kicked into the scheduling path. Implies SCX_ENQ_HEAD.

SCX_ENQ_REENQ: The task being enqueued was previously enqueued on the current CPU's SCX_DSQ_LOCAL, but was removed from it in a call to the scx_bpf_reenqueue_local kfunc. If scx_bpf_reenqueue_local was invoked in a ->cpu_release() callback, and the task is again dispatched back to SCX_LOCAL_DSQ by this current ->enqueue(), the task will not be scheduled on the CPU until at least the next invocation of the ->cpu_acquire() callback.

SCX_ENQ_LAST: The task being enqueued is the only task available for the cpu. By default, ext core keeps executing such tasks but when SCX_OPS_ENQ_LAST is specified, they are ops.enqueue()'d with the SCX_ENQ_LAST flag set. The BPF scheduler is responsible for triggering a follow-up scheduling event. Otherwise, Execution may stall.

Return

Returns true if p has been consumed, false if p had already been consumed or dequeued.

Signature

bool scx_bpf_dsq_move(struct bpf_iter_scx_dsq *it__iter, struct task_struct *p, u64 dsq_id, u64 enq_flags)

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