1.. _sched-ext: 2 3========================== 4Extensible Scheduler Class 5========================== 6 7sched_ext is a scheduler class whose behavior can be defined by a set of BPF 8programs - the BPF scheduler. 9 10* sched_ext exports a full scheduling interface so that any scheduling 11 algorithm can be implemented on top. 12 13* The BPF scheduler can group CPUs however it sees fit and schedule them 14 together, as tasks aren't tied to specific CPUs at the time of wakeup. 15 16* The BPF scheduler can be turned on and off dynamically anytime. 17 18* The system integrity is maintained no matter what the BPF scheduler does. 19 The default scheduling behavior is restored anytime an error is detected, 20 a runnable task stalls, or on invoking the SysRq key sequence 21 `SysRq-S`. 22 23* When the BPF scheduler triggers an error, debug information is dumped to 24 aid debugging. The debug dump is passed to and printed out by the 25 scheduler binary. The debug dump can also be accessed through the 26 `sched_ext_dump` tracepoint. The SysRq key sequence `SysRq-D` 27 triggers a debug dump. This doesn't terminate the BPF scheduler and can 28 only be read through the tracepoint. 29 30Switching to and from sched_ext 31=============================== 32 33``CONFIG_SCHED_CLASS_EXT`` is the config option to enable sched_ext and 34``tools/sched_ext`` contains the example schedulers. The following config 35options should be enabled to use sched_ext: 36 37.. code-block:: none 38 39 CONFIG_BPF=y 40 CONFIG_SCHED_CLASS_EXT=y 41 CONFIG_BPF_SYSCALL=y 42 CONFIG_BPF_JIT=y 43 CONFIG_DEBUG_INFO_BTF=y 44 CONFIG_BPF_JIT_ALWAYS_ON=y 45 CONFIG_BPF_JIT_DEFAULT_ON=y 46 47sched_ext is used only when the BPF scheduler is loaded and running. 48 49If a task explicitly sets its scheduling policy to ``SCHED_EXT``, it will be 50treated as ``SCHED_NORMAL`` and scheduled by the fair-class scheduler until the 51BPF scheduler is loaded. 52 53When the BPF scheduler is loaded and ``SCX_OPS_SWITCH_PARTIAL`` is not set 54in ``ops->flags``, all ``SCHED_NORMAL``, ``SCHED_BATCH``, ``SCHED_IDLE``, and 55``SCHED_EXT`` tasks are scheduled by sched_ext. 56 57However, when the BPF scheduler is loaded and ``SCX_OPS_SWITCH_PARTIAL`` is 58set in ``ops->flags``, only tasks with the ``SCHED_EXT`` policy are scheduled 59by sched_ext, while tasks with ``SCHED_NORMAL``, ``SCHED_BATCH`` and 60``SCHED_IDLE`` policies are scheduled by the fair-class scheduler which has 61higher sched_class precedence than ``SCHED_EXT``. 62 63Terminating the sched_ext scheduler program, triggering `SysRq-S`, or 64detection of any internal error including stalled runnable tasks aborts the 65BPF scheduler and reverts all tasks back to the fair-class scheduler. 66 67.. code-block:: none 68 69 # make -j16 -C tools/sched_ext 70 # tools/sched_ext/build/bin/scx_simple 71 local=0 global=3 72 local=5 global=24 73 local=9 global=44 74 local=13 global=56 75 local=17 global=72 76 ^CEXIT: BPF scheduler unregistered 77 78The current status of the BPF scheduler can be determined as follows: 79 80.. code-block:: none 81 82 # cat /sys/kernel/sched_ext/state 83 enabled 84 # cat /sys/kernel/sched_ext/root/ops 85 simple 86 87You can check if any BPF scheduler has ever been loaded since boot by examining 88this monotonically incrementing counter (a value of zero indicates that no BPF 89scheduler has been loaded): 90 91.. code-block:: none 92 93 # cat /sys/kernel/sched_ext/enable_seq 94 1 95 96Each running scheduler exposes an ``events`` file under its sysfs kobject 97(``/sys/kernel/sched_ext/root/events`` for the root scheduler) that tracks 98diagnostic counters. Each counter occupies one ``name value`` line: 99 100.. code-block:: none 101 102 # cat /sys/kernel/sched_ext/root/events 103 SCX_EV_SELECT_CPU_FALLBACK 0 104 SCX_EV_DISPATCH_LOCAL_DSQ_OFFLINE 0 105 SCX_EV_DISPATCH_KEEP_LAST 123 106 SCX_EV_ENQ_SKIP_EXITING 0 107 SCX_EV_ENQ_SKIP_MIGRATION_DISABLED 0 108 SCX_EV_REENQ_IMMED 0 109 SCX_EV_REENQ_REPEAT 0 110 SCX_EV_REFILL_SLICE_DFL 456789 111 SCX_EV_BYPASS_DURATION 0 112 SCX_EV_BYPASS_DISPATCH 0 113 SCX_EV_BYPASS_ACTIVATE 0 114 SCX_EV_INSERT_NOT_OWNED 0 115 SCX_EV_SUB_BYPASS_DISPATCH 0 116 117The counters are described in ``kernel/sched/ext/internal.h``; briefly: 118 119* ``SCX_EV_SELECT_CPU_FALLBACK``: ops.select_cpu() returned a CPU unusable by 120 the task and the core scheduler silently picked a fallback CPU. 121* ``SCX_EV_DISPATCH_LOCAL_DSQ_OFFLINE``: a local-DSQ dispatch was redirected 122 to the global DSQ because the target CPU went offline. 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 126 directly, bypassing ops.enqueue() (only when ``SCX_OPS_ENQ_EXITING`` is not set). 127* ``SCX_EV_ENQ_SKIP_MIGRATION_DISABLED``: a migration-disabled task was 128 dispatched to its local DSQ directly (only when 129 ``SCX_OPS_ENQ_MIGRATION_DISABLED`` is not set). 130* ``SCX_EV_REENQ_IMMED``: a task dispatched with ``SCX_ENQ_IMMED`` was 131 re-enqueued because the target CPU was not available for immediate execution. 132* ``SCX_EV_REENQ_REPEAT``: a reenqueue led to another reenqueue without the 133 task running in between; recurring counts indicate that the BPF scheduler 134 keeps re-deciding placements it can't honor. 135* ``SCX_EV_REFILL_SLICE_DFL``: a task's time slice was refilled with the 136 default value (``SCX_SLICE_DFL``). 137* ``SCX_EV_BYPASS_DURATION``: total nanoseconds spent in bypass mode. 138* ``SCX_EV_BYPASS_DISPATCH``: number of tasks dispatched while in bypass mode. 139* ``SCX_EV_BYPASS_ACTIVATE``: number of times bypass mode was activated. 140* ``SCX_EV_INSERT_NOT_OWNED``: attempted to insert a task not owned by this 141 scheduler into a DSQ; such attempts are silently ignored. 142* ``SCX_EV_SUB_BYPASS_DISPATCH``: tasks dispatched from sub-scheduler bypass 143 DSQs (only relevant with ``CONFIG_EXT_SUB_SCHED``). 144 145``tools/sched_ext/scx_show_state.py`` is a drgn script which shows more 146detailed information: 147 148.. code-block:: none 149 150 # tools/sched_ext/scx_show_state.py 151 ops : simple 152 enabled : 1 153 switching_all : 1 154 switched_all : 1 155 enable_state : enabled (2) 156 aborting : False 157 bypass_depth : 0 158 nr_rejected : 0 159 enable_seq : 1 160 161Whether a given task is on sched_ext can be determined as follows: 162 163.. code-block:: none 164 165 # grep ext /proc/self/sched 166 ext.enabled : 1 167 168The Basics 169========== 170 171Userspace can implement an arbitrary BPF scheduler by loading a set of BPF 172programs that implement ``struct sched_ext_ops``. The only mandatory field 173is ``ops.name`` which must be a valid BPF object name. All operations are 174optional. The following modified excerpt is from 175``tools/sched_ext/scx_simple.bpf.c`` showing a minimal global FIFO scheduler. 176 177.. code-block:: c 178 179 /* 180 * Decide which CPU a task should be migrated to before being 181 * enqueued (either at wakeup, fork time, or exec time). If an 182 * idle core is found by the default ops.select_cpu() implementation, 183 * then insert the task directly into SCX_DSQ_LOCAL and skip the 184 * ops.enqueue() callback. 185 * 186 * Note that this implementation has exactly the same behavior as the 187 * default ops.select_cpu implementation. The behavior of the scheduler 188 * would be exactly same if the implementation just didn't define the 189 * simple_select_cpu() struct_ops prog. 190 */ 191 s32 BPF_STRUCT_OPS(simple_select_cpu, struct task_struct *p, 192 s32 prev_cpu, u64 wake_flags) 193 { 194 s32 cpu; 195 /* Need to initialize or the BPF verifier will reject the program */ 196 bool direct = false; 197 198 cpu = scx_bpf_select_cpu_dfl(p, prev_cpu, wake_flags, &direct); 199 200 if (direct) 201 scx_bpf_dsq_insert(p, SCX_DSQ_LOCAL, SCX_SLICE_DFL, 0); 202 203 return cpu; 204 } 205 206 /* 207 * Do a direct insertion of a task to the global DSQ. This ops.enqueue() 208 * callback will only be invoked if we failed to find a core to insert 209 * into in ops.select_cpu() above. 210 * 211 * Note that this implementation has exactly the same behavior as the 212 * default ops.enqueue implementation, which just dispatches the task 213 * to SCX_DSQ_GLOBAL. The behavior of the scheduler would be exactly same 214 * if the implementation just didn't define the simple_enqueue struct_ops 215 * prog. 216 */ 217 void BPF_STRUCT_OPS(simple_enqueue, struct task_struct *p, u64 enq_flags) 218 { 219 scx_bpf_dsq_insert(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, enq_flags); 220 } 221 222 s32 BPF_STRUCT_OPS_SLEEPABLE(simple_init) 223 { 224 /* 225 * By default, all SCHED_EXT, SCHED_OTHER, SCHED_IDLE, and 226 * SCHED_BATCH tasks should use sched_ext. 227 */ 228 return 0; 229 } 230 231 void BPF_STRUCT_OPS(simple_exit, struct scx_exit_info *ei) 232 { 233 exit_type = ei->type; 234 } 235 236 SEC(".struct_ops") 237 struct sched_ext_ops simple_ops = { 238 .select_cpu = (void *)simple_select_cpu, 239 .enqueue = (void *)simple_enqueue, 240 .init = (void *)simple_init, 241 .exit = (void *)simple_exit, 242 .name = "simple", 243 }; 244 245Dispatch Queues 246--------------- 247 248To match the impedance between the scheduler core and the BPF scheduler, 249sched_ext uses DSQs (dispatch queues) which can operate as both a FIFO and a 250priority queue. By default, there is one global FIFO (``SCX_DSQ_GLOBAL``), 251and one local DSQ per CPU (``SCX_DSQ_LOCAL``). The BPF scheduler can manage 252an arbitrary number of DSQs using ``scx_bpf_create_dsq()`` and 253``scx_bpf_destroy_dsq()``. 254 255A CPU always executes a task from its local DSQ. A task is "inserted" into a 256DSQ. A task in a non-local DSQ is "move"d into the target CPU's local DSQ. 257 258When a CPU is looking for the next task to run, if the local DSQ is not 259empty, the first task is picked. Otherwise, the CPU tries to move a task 260from the global DSQ. If that doesn't yield a runnable task either, 261``ops.dispatch()`` is invoked. 262 263Scheduling Cycle 264---------------- 265 266The following briefly shows how a waking task is scheduled and executed. 267 2681. When a task is waking up, ``ops.select_cpu()`` is the first operation 269 invoked. This serves two purposes. First, CPU selection optimization 270 hint. Second, waking up the selected CPU if idle. 271 272 The CPU selected by ``ops.select_cpu()`` is an optimization hint and not 273 binding. The actual decision is made at the last step of scheduling. 274 However, there is a small performance gain if the CPU 275 ``ops.select_cpu()`` returns matches the CPU the task eventually runs on. 276 277 A side-effect of selecting a CPU is waking it up from idle. While a BPF 278 scheduler can wake up any cpu using the ``scx_bpf_kick_cpu()`` helper, 279 using ``ops.select_cpu()`` judiciously can be simpler and more efficient. 280 281 Note that the scheduler core will ignore an invalid CPU selection, for 282 example, if it's outside the allowed cpumask of the task. 283 284 A task can be immediately inserted into a DSQ from ``ops.select_cpu()`` 285 by calling ``scx_bpf_dsq_insert()`` or ``scx_bpf_dsq_insert_vtime()``. 286 287 If the task is inserted into ``SCX_DSQ_LOCAL`` from 288 ``ops.select_cpu()``, it will be added to the local DSQ of whichever CPU 289 is returned from ``ops.select_cpu()``. Additionally, inserting directly 290 from ``ops.select_cpu()`` will cause the ``ops.enqueue()`` callback to 291 be skipped. 292 293 Any other attempt to store a task in BPF-internal data structures from 294 ``ops.select_cpu()`` does not prevent ``ops.enqueue()`` from being 295 invoked. This is discouraged, as it can introduce racy behavior or 296 inconsistent state. 297 2982. Once the target CPU is selected, ``ops.enqueue()`` is invoked (unless the 299 task was inserted directly from ``ops.select_cpu()``). ``ops.enqueue()`` 300 can make one of the following decisions: 301 302 * Immediately insert the task into either the global or a local DSQ by 303 calling ``scx_bpf_dsq_insert()`` with one of the following options: 304 ``SCX_DSQ_GLOBAL``, ``SCX_DSQ_LOCAL``, or ``SCX_DSQ_LOCAL_ON | cpu``. 305 306 * Immediately insert the task into a custom DSQ by calling 307 ``scx_bpf_dsq_insert()`` with a DSQ ID which is smaller than 2^63. 308 309 * Queue the task on the BPF side. 310 311 **Task State Tracking and ops.dequeue() Semantics** 312 313 A task is in the "BPF scheduler's custody" when the BPF scheduler is 314 responsible for managing its lifecycle. A task enters custody when it is 315 dispatched to a user DSQ or stored in the BPF scheduler's internal data 316 structures. Custody is entered only from ``ops.enqueue()`` for those 317 operations. The only exception is dispatching to a user DSQ from 318 ``ops.select_cpu()``: although the task is not yet technically in BPF 319 scheduler custody at that point, the dispatch has the same semantic 320 effect as dispatching from ``ops.enqueue()`` for custody-related 321 purposes. 322 323 Once ``ops.enqueue()`` is called, the task may or may not enter custody 324 depending on what the scheduler does: 325 326 * **Directly dispatched to terminal DSQs** (``SCX_DSQ_LOCAL``, 327 ``SCX_DSQ_LOCAL_ON | cpu``, or ``SCX_DSQ_GLOBAL``): the BPF scheduler 328 is done with the task - it either goes straight to a CPU's local run 329 queue or to the global DSQ as a fallback. The task never enters (or 330 exits) BPF custody, and ``ops.dequeue()`` will not be called. 331 332 * **Dispatch to user-created DSQs** (custom DSQs): the task enters the 333 BPF scheduler's custody. When the task later leaves BPF custody 334 (dispatched to a terminal DSQ, picked by core-sched, or dequeued for 335 sleep/property changes), ``ops.dequeue()`` will be called exactly 336 once. 337 338 * **Stored in BPF data structures** (e.g., internal BPF queues): the 339 task is in BPF custody. ``ops.dequeue()`` will be called when it 340 leaves (e.g., when ``ops.dispatch()`` moves it to a terminal DSQ, or 341 on property change / sleep). 342 343 Note that ``ops.enqueue()`` can be called multiple times in a row without 344 an intervening call to ``ops.dequeue()``. This can happen, for example, 345 when a task on a user-created DSQ is re-enqueued using 346 ``scx_bpf_dsq_reenq()``. The task stays in BPF custody the entire time. 347 348 When a task leaves BPF scheduler custody, ``ops.dequeue()`` is invoked. 349 The dequeue can happen for different reasons, distinguished by flags: 350 351 1. **Regular dispatch**: when a task in BPF custody is dispatched to a 352 terminal DSQ from ``ops.dispatch()`` (leaving BPF custody for 353 execution), ``ops.dequeue()`` is triggered without any special flags. 354 355 2. **Core scheduling pick**: when ``CONFIG_SCHED_CORE`` is enabled and 356 core scheduling picks a task for execution while it's still in BPF 357 custody, ``ops.dequeue()`` is called with the 358 ``SCX_DEQ_CORE_SCHED_EXEC`` flag. 359 360 3. **Scheduling property change**: when a task property changes (via 361 operations like ``sched_setaffinity()``, ``sched_setscheduler()``, 362 priority changes, CPU migrations, etc.) while the task is still in 363 BPF custody, ``ops.dequeue()`` is called with the 364 ``SCX_DEQ_SCHED_CHANGE`` flag set in ``deq_flags``. 365 366 **Important**: Once a task has left BPF custody (e.g., after being 367 dispatched to a terminal DSQ), property changes will not trigger 368 ``ops.dequeue()``, since the task is no longer managed by the BPF 369 scheduler. 370 3713. When a CPU is ready to schedule, it first looks at its local DSQ. If 372 empty, it then looks at the global DSQ. If there still isn't a task to 373 run, ``ops.dispatch()`` is invoked which can use the following two 374 functions to populate the local DSQ. 375 376 * ``scx_bpf_dsq_insert()`` inserts a task to a DSQ. Any target DSQ can be 377 used - ``SCX_DSQ_LOCAL``, ``SCX_DSQ_LOCAL_ON | cpu``, 378 ``SCX_DSQ_GLOBAL`` or a custom DSQ. While ``scx_bpf_dsq_insert()`` 379 currently can't be called with BPF locks held, this is being worked on 380 and will be supported. ``scx_bpf_dsq_insert()`` schedules insertion 381 rather than performing them immediately. There can be up to 382 ``ops.dispatch_max_batch`` pending tasks. 383 384 * ``scx_bpf_dsq_move_to_local()`` moves a task from the specified non-local 385 DSQ to the dispatching DSQ. This function cannot be called with any BPF 386 locks held. ``scx_bpf_dsq_move_to_local()`` flushes the pending insertions 387 tasks before trying to move from the specified DSQ. 388 3894. After ``ops.dispatch()`` returns, if there are tasks in the local DSQ, 390 the CPU runs the first one. If empty, the following steps are taken: 391 392 * Try to move from the global DSQ. If successful, run the task. 393 394 * If ``ops.dispatch()`` has dispatched any tasks, retry #3. 395 396 * If the previous task is an SCX task and still runnable, keep executing 397 it (see ``SCX_OPS_ENQ_LAST``). 398 399 * Go idle. 400 401Note that the BPF scheduler can always choose to dispatch tasks immediately 402in ``ops.enqueue()`` as illustrated in the above simple example. If only the 403built-in DSQs are used, there is no need to implement ``ops.dispatch()`` as 404a task is never queued on the BPF scheduler and both the local and global 405DSQs are executed automatically. 406 407``scx_bpf_dsq_insert()`` inserts the task on the FIFO of the target DSQ. Use 408``scx_bpf_dsq_insert_vtime()`` for the priority queue. Internal DSQs such as 409``SCX_DSQ_LOCAL`` and ``SCX_DSQ_GLOBAL`` do not support priority-queue 410dispatching, and must be dispatched to with ``scx_bpf_dsq_insert()``. See 411the function documentation and usage in ``tools/sched_ext/scx_simple.bpf.c`` 412for more information. 413 414Task Lifecycle 415-------------- 416 417The following pseudo-code presents a rough overview of the entire lifecycle 418of a task managed by a sched_ext scheduler: 419 420.. code-block:: c 421 422 ops.init_task(); /* A new task is created */ 423 ops.enable(); /* Enable BPF scheduling for the task */ 424 425 while (task in SCHED_EXT) { 426 if (task can migrate) 427 ops.select_cpu(); /* Called on wakeup (optimization) */ 428 429 ops.runnable(); /* Task becomes ready to run */ 430 431 while (task_is_runnable(task)) { 432 if (task is not in a DSQ || task->scx.slice == 0) { 433 ops.enqueue(); /* Task can be added to a DSQ */ 434 435 /* Task property change (i.e., affinity, nice, etc.)? */ 436 if (sched_change(task)) { 437 ops.dequeue(); /* Exiting BPF scheduler custody */ 438 ops.quiescent(); 439 440 /* Property change callback, e.g. ops.set_weight() */ 441 442 ops.runnable(); 443 continue; 444 } 445 446 /* Any usable CPU becomes available */ 447 448 ops.dispatch(); /* Task is moved to a local DSQ */ 449 ops.dequeue(); /* Exiting BPF scheduler custody */ 450 } 451 452 ops.running(); /* Task starts running on its assigned CPU */ 453 454 while (task_is_runnable(task) && task->scx.slice > 0) { 455 ops.tick(); /* Called every 1/HZ seconds */ 456 457 if (task->scx.slice == 0) 458 ops.dispatch(); /* task->scx.slice can be refilled */ 459 } 460 461 ops.stopping(); /* Task stops running (time slice expires or wait) */ 462 } 463 464 ops.quiescent(); /* Task releases its assigned CPU (wait) */ 465 } 466 467 ops.disable(); /* Disable BPF scheduling for the task */ 468 ops.exit_task(); /* Task is destroyed */ 469 470Note that the above pseudo-code does not cover all possible state transitions 471and edge cases, to name a few examples: 472 473* ``ops.dispatch()`` may fail to move the task to a local DSQ due to a racing 474 property change on that task, in which case ``ops.dispatch()`` will be 475 retried. 476 477* The task may be direct-dispatched to a local DSQ from ``ops.enqueue()``, 478 in which case ``ops.dispatch()`` and ``ops.dequeue()`` are skipped and we go 479 straight to ``ops.running()``. 480 481* Property changes may occur at virtually any point during the task's lifecycle, 482 not just when the task is queued and waiting to be dispatched. For example, 483 changing a property of a running task will lead to the callback sequence 484 ``ops.stopping()`` -> ``ops.quiescent()`` -> (property change callback) -> 485 ``ops.runnable()`` -> ``ops.running()``. 486 487* A sched_ext task can be preempted by a task from a higher-priority scheduling 488 class, in which case it will exit the tick-dispatch loop even though it is runnable 489 and has a non-zero slice. 490 491See the "Scheduling Cycle" section for a more detailed description of how 492a freshly woken up task gets on a CPU. 493 494Where to Look 495============= 496 497* ``include/linux/sched/ext.h`` defines the core data structures and 498 constants, while the ops table (``struct sched_ext_ops``) is defined in 499 ``kernel/sched/ext/internal.h``. 500 501* ``kernel/sched/ext/ext.c`` contains sched_ext core implementation and helpers. 502 The functions prefixed with ``scx_bpf_`` can be called from the BPF 503 scheduler. 504 505* ``kernel/sched/ext/idle.c`` contains the built-in idle CPU selection policy. 506 507* ``tools/sched_ext/`` hosts example BPF scheduler implementations. 508 509 * ``scx_simple[.bpf].c``: Minimal global FIFO scheduler example using a 510 custom DSQ. 511 512 * ``scx_qmap[.bpf].c``: A multi-level FIFO scheduler supporting five 513 levels of priority implemented with arena-backed doubly-linked lists. 514 515 * ``scx_central[.bpf].c``: A central FIFO scheduler where all scheduling 516 decisions are made on one CPU, demonstrating ``LOCAL_ON`` dispatching, 517 tickless operation, and kthread preemption. 518 519 * ``scx_cpu0[.bpf].c``: A scheduler that queues all tasks to a shared DSQ 520 and only dispatches them on CPU0 in FIFO order. Useful for testing bypass 521 behavior. 522 523 * ``scx_flatcg[.bpf].c``: A flattened cgroup hierarchy scheduler 524 implementing hierarchical weight-based cgroup CPU control by compounding 525 each cgroup's share at every level into a single flat scheduling layer. 526 527 * ``scx_pair[.bpf].c``: A core-scheduling example that always makes 528 sibling CPU pairs execute tasks from the same CPU cgroup. 529 530 * ``scx_sdt[.bpf].c``: A variation of ``scx_simple`` demonstrating BPF 531 arena memory management for per-task data. 532 533 * ``scx_userland[.bpf].c``: A minimal scheduler demonstrating user space 534 scheduling. Tasks with CPU affinity are direct-dispatched in FIFO order; 535 all others are scheduled in user space by a simple vruntime scheduler. 536 537Module Parameters 538================= 539 540sched_ext exposes two module parameters under the ``sched_ext.`` prefix that 541control bypass-mode behaviour. These knobs are primarily for debugging; there 542is usually no reason to change them during normal operation. They can be read 543and written at runtime (mode 0600) via 544``/sys/module/sched_ext/parameters/``. 545 546``sched_ext.slice_bypass_us`` (default: 5000 µs) 547 The time slice assigned to all tasks when the scheduler is in bypass mode, 548 i.e. during BPF scheduler load, unload, and error recovery. Valid range is 549 100 µs to 100 ms. 550 551``sched_ext.bypass_lb_intv_us`` (default: 500000 µs) 552 The interval at which the bypass-mode load balancer redistributes tasks 553 across CPUs. Set to 0 to disable load balancing during bypass mode. Valid 554 range is 0 to 10 s. 555 556ABI Instability 557=============== 558 559The APIs provided by sched_ext to BPF schedulers programs have no stability 560guarantees. This includes the ops table callbacks defined in 561``kernel/sched/ext/internal.h`` and the constants defined in 562``include/linux/sched/ext.h``, as well as the ``scx_bpf_`` kfuncs defined in 563``kernel/sched/ext/ext.c`` and ``kernel/sched/ext/idle.c``. 564 565While we will attempt to provide a relatively stable API surface when 566possible, they are subject to change without warning between kernel 567versions. 568