Lines Matching full:task

20   a runnable task stalls, or on invoking the SysRq key sequence
49 If a task explicitly sets its scheduling policy to ``SCHED_EXT``, it will be
120 the task and the core scheduler silently picked a fallback CPU.
123 * ``SCX_EV_DISPATCH_KEEP_LAST``: a task continued running because no other
124 task was available (only when ``SCX_OPS_ENQ_LAST`` is not set).
125 * ``SCX_EV_ENQ_SKIP_EXITING``: an exiting task was dispatched to the local DSQ
127 * ``SCX_EV_ENQ_SKIP_MIGRATION_DISABLED``: a migration-disabled task was
130 * ``SCX_EV_REENQ_IMMED``: a task dispatched with ``SCX_ENQ_IMMED`` was
135 * ``SCX_EV_REFILL_SLICE_DFL``: a task's time slice was refilled with the
140 * ``SCX_EV_INSERT_NOT_OWNED``: attempted to insert a task not owned by this
160 Whether a given task is on sched_ext can be determined as follows:
179 * Decide which CPU a task should be migrated to before being
182 * then insert the task directly into SCX_DSQ_LOCAL and skip the
206 * Do a direct insertion of a task to the global DSQ. This ops.enqueue()
211 * default ops.enqueue implementation, which just dispatches the task
254 A CPU always executes a task from its local DSQ. A task is "inserted" into a
255 DSQ. A task in a non-local DSQ is "move"d into the target CPU's local DSQ.
257 When a CPU is looking for the next task to run, if the local DSQ is not
258 empty, the first task is picked. Otherwise, the CPU tries to move a task
259 from the global DSQ. If that doesn't yield a runnable task either,
265 The following briefly shows how a waking task is scheduled and executed.
267 1. When a task is waking up, ``ops.select_cpu()`` is the first operation
274 ``ops.select_cpu()`` returns matches the CPU the task eventually runs on.
281 example, if it's outside the allowed cpumask of the task.
283 A task can be immediately inserted into a DSQ from ``ops.select_cpu()``
286 If the task is inserted into ``SCX_DSQ_LOCAL`` from
292 Any other attempt to store a task in BPF-internal data structures from
298 task was inserted directly from ``ops.select_cpu()``). ``ops.enqueue()``
301 * Immediately insert the task into either the global or a local DSQ by
305 * Immediately insert the task into a custom DSQ by calling
308 * Queue the task on the BPF side.
310 **Task State Tracking and ops.dequeue() Semantics**
312 A task is in the "BPF scheduler's custody" when the BPF scheduler is
313 responsible for managing its lifecycle. A task enters custody when it is
317 ``ops.select_cpu()``: although the task is not yet technically in BPF
322 Once ``ops.enqueue()`` is called, the task may or may not enter custody
327 is done with the task - it either goes straight to a CPU's local run
328 queue or to the global DSQ as a fallback. The task never enters (or
331 * **Dispatch to user-created DSQs** (custom DSQs): the task enters the
332 BPF scheduler's custody. When the task later leaves BPF custody
338 task is in BPF custody. ``ops.dequeue()`` will be called when it
342 When a task leaves BPF scheduler custody, ``ops.dequeue()`` is invoked.
345 1. **Regular dispatch**: when a task in BPF custody is dispatched to a
350 core scheduling picks a task for execution while it's still in BPF
354 3. **Scheduling property change**: when a task property changes (via
356 priority changes, CPU migrations, etc.) while the task is still in
360 **Important**: Once a task has left BPF custody (e.g., after being
362 ``ops.dequeue()``, since the task is no longer managed by the BPF
366 empty, it then looks at the global DSQ. If there still isn't a task to
370 * ``scx_bpf_dsq_insert()`` inserts a task to a DSQ. Any target DSQ can be
378 * ``scx_bpf_dsq_move_to_local()`` moves a task from the specified non-local
386 * Try to move from the global DSQ. If successful, run the task.
390 * If the previous task is an SCX task and still runnable, keep executing
398 a task is never queued on the BPF scheduler and both the local and global
401 ``scx_bpf_dsq_insert()`` inserts the task on the FIFO of the target DSQ. Use
408 Task Lifecycle
412 of a task managed by a sched_ext scheduler:
416 ops.init_task(); /* A new task is created */
417 ops.enable(); /* Enable BPF scheduling for the task */
419 while (task in SCHED_EXT) {
420 if (task can migrate)
423 ops.runnable(); /* Task becomes ready to run */
425 while (task_is_runnable(task)) {
426 if (task is not in a DSQ || task->scx.slice == 0) {
427 ops.enqueue(); /* Task can be added to a DSQ */
429 /* Task property change (i.e., affinity, nice, etc.)? */
430 if (sched_change(task)) {
442 ops.dispatch(); /* Task is moved to a local DSQ */
446 ops.running(); /* Task starts running on its assigned CPU */
448 while (task_is_runnable(task) && task->scx.slice > 0) {
451 if (task->scx.slice == 0)
452 ops.dispatch(); /* task->scx.slice can be refilled */
455 ops.stopping(); /* Task stops running (time slice expires or wait) */
458 ops.quiescent(); /* Task releases its assigned CPU (wait) */
461 ops.disable(); /* Disable BPF scheduling for the task */
462 ops.exit_task(); /* Task is destroyed */
467 * ``ops.dispatch()`` may fail to move the task to a local DSQ due to a racing
468 property change on that task, in which case ``ops.dispatch()`` will be
471 * The task may be direct-dispatched to a local DSQ from ``ops.enqueue()``,
475 * Property changes may occur at virtually any point during the task's lifecycle,
476 not just when the task is queued and waiting to be dispatched. For example,
477 changing a property of a running task will lead to the callback sequence
481 * A sched_ext task can be preempted by a task from a higher-priority scheduling
486 a freshly woken up task gets on a CPU.
524 arena memory management for per-task data.