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 also exposes a per-scheduler ``events`` file under 97``/sys/kernel/sched_ext/<scheduler-name>/events`` that tracks diagnostic 98counters. Each counter occupies one ``name value`` line: 99 100.. code-block:: none 101 102 # cat /sys/kernel/sched_ext/simple/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_LOCAL_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_LOCAL_REPEAT``: a reenqueue of the local DSQ triggered 133 another reenqueue; recurring counts indicate incorrect ``SCX_ENQ_REENQ`` 134 handling in the BPF scheduler. 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 bypass_depth : 0 157 nr_rejected : 0 158 enable_seq : 1 159 160Whether a given task is on sched_ext can be determined as follows: 161 162.. code-block:: none 163 164 # grep ext /proc/self/sched 165 ext.enabled : 1 166 167The Basics 168========== 169 170Userspace can implement an arbitrary BPF scheduler by loading a set of BPF 171programs that implement ``struct sched_ext_ops``. The only mandatory field 172is ``ops.name`` which must be a valid BPF object name. All operations are 173optional. The following modified excerpt is from 174``tools/sched_ext/scx_simple.bpf.c`` showing a minimal global FIFO scheduler. 175 176.. code-block:: c 177 178 /* 179 * Decide which CPU a task should be migrated to before being 180 * enqueued (either at wakeup, fork time, or exec time). If an 181 * idle core is found by the default ops.select_cpu() implementation, 182 * then insert the task directly into SCX_DSQ_LOCAL and skip the 183 * ops.enqueue() callback. 184 * 185 * Note that this implementation has exactly the same behavior as the 186 * default ops.select_cpu implementation. The behavior of the scheduler 187 * would be exactly same if the implementation just didn't define the 188 * simple_select_cpu() struct_ops prog. 189 */ 190 s32 BPF_STRUCT_OPS(simple_select_cpu, struct task_struct *p, 191 s32 prev_cpu, u64 wake_flags) 192 { 193 s32 cpu; 194 /* Need to initialize or the BPF verifier will reject the program */ 195 bool direct = false; 196 197 cpu = scx_bpf_select_cpu_dfl(p, prev_cpu, wake_flags, &direct); 198 199 if (direct) 200 scx_bpf_dsq_insert(p, SCX_DSQ_LOCAL, SCX_SLICE_DFL, 0); 201 202 return cpu; 203 } 204 205 /* 206 * Do a direct insertion of a task to the global DSQ. This ops.enqueue() 207 * callback will only be invoked if we failed to find a core to insert 208 * into in ops.select_cpu() above. 209 * 210 * Note that this implementation has exactly the same behavior as the 211 * default ops.enqueue implementation, which just dispatches the task 212 * to SCX_DSQ_GLOBAL. The behavior of the scheduler would be exactly same 213 * if the implementation just didn't define the simple_enqueue struct_ops 214 * prog. 215 */ 216 void BPF_STRUCT_OPS(simple_enqueue, struct task_struct *p, u64 enq_flags) 217 { 218 scx_bpf_dsq_insert(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, enq_flags); 219 } 220 221 s32 BPF_STRUCT_OPS_SLEEPABLE(simple_init) 222 { 223 /* 224 * By default, all SCHED_EXT, SCHED_OTHER, SCHED_IDLE, and 225 * SCHED_BATCH tasks should use sched_ext. 226 */ 227 return 0; 228 } 229 230 void BPF_STRUCT_OPS(simple_exit, struct scx_exit_info *ei) 231 { 232 exit_type = ei->type; 233 } 234 235 SEC(".struct_ops") 236 struct sched_ext_ops simple_ops = { 237 .select_cpu = (void *)simple_select_cpu, 238 .enqueue = (void *)simple_enqueue, 239 .init = (void *)simple_init, 240 .exit = (void *)simple_exit, 241 .name = "simple", 242 }; 243 244Dispatch Queues 245--------------- 246 247To match the impedance between the scheduler core and the BPF scheduler, 248sched_ext uses DSQs (dispatch queues) which can operate as both a FIFO and a 249priority queue. By default, there is one global FIFO (``SCX_DSQ_GLOBAL``), 250and one local DSQ per CPU (``SCX_DSQ_LOCAL``). The BPF scheduler can manage 251an arbitrary number of DSQs using ``scx_bpf_create_dsq()`` and 252``scx_bpf_destroy_dsq()``. 253 254A CPU always executes a task from its local DSQ. A task is "inserted" into a 255DSQ. A task in a non-local DSQ is "move"d into the target CPU's local DSQ. 256 257When a CPU is looking for the next task to run, if the local DSQ is not 258empty, the first task is picked. Otherwise, the CPU tries to move a task 259from the global DSQ. If that doesn't yield a runnable task either, 260``ops.dispatch()`` is invoked. 261 262Scheduling Cycle 263---------------- 264 265The following briefly shows how a waking task is scheduled and executed. 266 2671. When a task is waking up, ``ops.select_cpu()`` is the first operation 268 invoked. This serves two purposes. First, CPU selection optimization 269 hint. Second, waking up the selected CPU if idle. 270 271 The CPU selected by ``ops.select_cpu()`` is an optimization hint and not 272 binding. The actual decision is made at the last step of scheduling. 273 However, there is a small performance gain if the CPU 274 ``ops.select_cpu()`` returns matches the CPU the task eventually runs on. 275 276 A side-effect of selecting a CPU is waking it up from idle. While a BPF 277 scheduler can wake up any cpu using the ``scx_bpf_kick_cpu()`` helper, 278 using ``ops.select_cpu()`` judiciously can be simpler and more efficient. 279 280 Note that the scheduler core will ignore an invalid CPU selection, for 281 example, if it's outside the allowed cpumask of the task. 282 283 A task can be immediately inserted into a DSQ from ``ops.select_cpu()`` 284 by calling ``scx_bpf_dsq_insert()`` or ``scx_bpf_dsq_insert_vtime()``. 285 286 If the task is inserted into ``SCX_DSQ_LOCAL`` from 287 ``ops.select_cpu()``, it will be added to the local DSQ of whichever CPU 288 is returned from ``ops.select_cpu()``. Additionally, inserting directly 289 from ``ops.select_cpu()`` will cause the ``ops.enqueue()`` callback to 290 be skipped. 291 292 Any other attempt to store a task in BPF-internal data structures from 293 ``ops.select_cpu()`` does not prevent ``ops.enqueue()`` from being 294 invoked. This is discouraged, as it can introduce racy behavior or 295 inconsistent state. 296 2972. Once the target CPU is selected, ``ops.enqueue()`` is invoked (unless the 298 task was inserted directly from ``ops.select_cpu()``). ``ops.enqueue()`` 299 can make one of the following decisions: 300 301 * Immediately insert the task into either the global or a local DSQ by 302 calling ``scx_bpf_dsq_insert()`` with one of the following options: 303 ``SCX_DSQ_GLOBAL``, ``SCX_DSQ_LOCAL``, or ``SCX_DSQ_LOCAL_ON | cpu``. 304 305 * Immediately insert the task into a custom DSQ by calling 306 ``scx_bpf_dsq_insert()`` with a DSQ ID which is smaller than 2^63. 307 308 * Queue the task on the BPF side. 309 310 **Task State Tracking and ops.dequeue() Semantics** 311 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 314 dispatched to a user DSQ or stored in the BPF scheduler's internal data 315 structures. Custody is entered only from ``ops.enqueue()`` for those 316 operations. The only exception is dispatching to a user DSQ from 317 ``ops.select_cpu()``: although the task is not yet technically in BPF 318 scheduler custody at that point, the dispatch has the same semantic 319 effect as dispatching from ``ops.enqueue()`` for custody-related 320 purposes. 321 322 Once ``ops.enqueue()`` is called, the task may or may not enter custody 323 depending on what the scheduler does: 324 325 * **Directly dispatched to terminal DSQs** (``SCX_DSQ_LOCAL``, 326 ``SCX_DSQ_LOCAL_ON | cpu``, or ``SCX_DSQ_GLOBAL``): the BPF scheduler 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 329 exits) BPF custody, and ``ops.dequeue()`` will not be called. 330 331 * **Dispatch to user-created DSQs** (custom DSQs): the task enters the 332 BPF scheduler's custody. When the task later leaves BPF custody 333 (dispatched to a terminal DSQ, picked by core-sched, or dequeued for 334 sleep/property changes), ``ops.dequeue()`` will be called exactly 335 once. 336 337 * **Stored in BPF data structures** (e.g., internal BPF queues): the 338 task is in BPF custody. ``ops.dequeue()`` will be called when it 339 leaves (e.g., when ``ops.dispatch()`` moves it to a terminal DSQ, or 340 on property change / sleep). 341 342 Note that ``ops.enqueue()`` can be called multiple times in a row without 343 an intervening call to ``ops.dequeue()``. This can happen, for example, 344 when a task on a user-created DSQ is re-enqueued using 345 ``scx_bpf_dsq_reenq()``. The task stays in BPF custody the entire time. 346 347 When a task leaves BPF scheduler custody, ``ops.dequeue()`` is invoked. 348 The dequeue can happen for different reasons, distinguished by flags: 349 350 1. **Regular dispatch**: when a task in BPF custody is dispatched to a 351 terminal DSQ from ``ops.dispatch()`` (leaving BPF custody for 352 execution), ``ops.dequeue()`` is triggered without any special flags. 353 354 2. **Core scheduling pick**: when ``CONFIG_SCHED_CORE`` is enabled and 355 core scheduling picks a task for execution while it's still in BPF 356 custody, ``ops.dequeue()`` is called with the 357 ``SCX_DEQ_CORE_SCHED_EXEC`` flag. 358 359 3. **Scheduling property change**: when a task property changes (via 360 operations like ``sched_setaffinity()``, ``sched_setscheduler()``, 361 priority changes, CPU migrations, etc.) while the task is still in 362 BPF custody, ``ops.dequeue()`` is called with the 363 ``SCX_DEQ_SCHED_CHANGE`` flag set in ``deq_flags``. 364 365 **Important**: Once a task has left BPF custody (e.g., after being 366 dispatched to a terminal DSQ), property changes will not trigger 367 ``ops.dequeue()``, since the task is no longer managed by the BPF 368 scheduler. 369 3703. When a CPU is ready to schedule, it first looks at its local DSQ. If 371 empty, it then looks at the global DSQ. If there still isn't a task to 372 run, ``ops.dispatch()`` is invoked which can use the following two 373 functions to populate the local DSQ. 374 375 * ``scx_bpf_dsq_insert()`` inserts a task to a DSQ. Any target DSQ can be 376 used - ``SCX_DSQ_LOCAL``, ``SCX_DSQ_LOCAL_ON | cpu``, 377 ``SCX_DSQ_GLOBAL`` or a custom DSQ. While ``scx_bpf_dsq_insert()`` 378 currently can't be called with BPF locks held, this is being worked on 379 and will be supported. ``scx_bpf_dsq_insert()`` schedules insertion 380 rather than performing them immediately. There can be up to 381 ``ops.dispatch_max_batch`` pending tasks. 382 383 * ``scx_bpf_dsq_move_to_local()`` moves a task from the specified non-local 384 DSQ to the dispatching DSQ. This function cannot be called with any BPF 385 locks held. ``scx_bpf_dsq_move_to_local()`` flushes the pending insertions 386 tasks before trying to move from the specified DSQ. 387 3884. After ``ops.dispatch()`` returns, if there are tasks in the local DSQ, 389 the CPU runs the first one. If empty, the following steps are taken: 390 391 * Try to move from the global DSQ. If successful, run the task. 392 393 * If ``ops.dispatch()`` has dispatched any tasks, retry #3. 394 395 * If the previous task is an SCX task and still runnable, keep executing 396 it (see ``SCX_OPS_ENQ_LAST``). 397 398 * Go idle. 399 400Note that the BPF scheduler can always choose to dispatch tasks immediately 401in ``ops.enqueue()`` as illustrated in the above simple example. If only the 402built-in DSQs are used, there is no need to implement ``ops.dispatch()`` as 403a task is never queued on the BPF scheduler and both the local and global 404DSQs are executed automatically. 405 406``scx_bpf_dsq_insert()`` inserts the task on the FIFO of the target DSQ. Use 407``scx_bpf_dsq_insert_vtime()`` for the priority queue. Internal DSQs such as 408``SCX_DSQ_LOCAL`` and ``SCX_DSQ_GLOBAL`` do not support priority-queue 409dispatching, and must be dispatched to with ``scx_bpf_dsq_insert()``. See 410the function documentation and usage in ``tools/sched_ext/scx_simple.bpf.c`` 411for more information. 412 413Task Lifecycle 414-------------- 415 416The following pseudo-code presents a rough overview of the entire lifecycle 417of a task managed by a sched_ext scheduler: 418 419.. code-block:: c 420 421 ops.init_task(); /* A new task is created */ 422 ops.enable(); /* Enable BPF scheduling for the task */ 423 424 while (task in SCHED_EXT) { 425 if (task can migrate) 426 ops.select_cpu(); /* Called on wakeup (optimization) */ 427 428 ops.runnable(); /* Task becomes ready to run */ 429 430 while (task_is_runnable(task)) { 431 if (task is not in a DSQ || task->scx.slice == 0) { 432 ops.enqueue(); /* Task can be added to a DSQ */ 433 434 /* Task property change (i.e., affinity, nice, etc.)? */ 435 if (sched_change(task)) { 436 ops.dequeue(); /* Exiting BPF scheduler custody */ 437 ops.quiescent(); 438 439 /* Property change callback, e.g. ops.set_weight() */ 440 441 ops.runnable(); 442 continue; 443 } 444 445 /* Any usable CPU becomes available */ 446 447 ops.dispatch(); /* Task is moved to a local DSQ */ 448 ops.dequeue(); /* Exiting BPF scheduler custody */ 449 } 450 451 ops.running(); /* Task starts running on its assigned CPU */ 452 453 while (task_is_runnable(task) && task->scx.slice > 0) { 454 ops.tick(); /* Called every 1/HZ seconds */ 455 456 if (task->scx.slice == 0) 457 ops.dispatch(); /* task->scx.slice can be refilled */ 458 } 459 460 ops.stopping(); /* Task stops running (time slice expires or wait) */ 461 } 462 463 ops.quiescent(); /* Task releases its assigned CPU (wait) */ 464 } 465 466 ops.disable(); /* Disable BPF scheduling for the task */ 467 ops.exit_task(); /* Task is destroyed */ 468 469Note that the above pseudo-code does not cover all possible state transitions 470and edge cases, to name a few examples: 471 472* ``ops.dispatch()`` may fail to move the task to a local DSQ due to a racing 473 property change on that task, in which case ``ops.dispatch()`` will be 474 retried. 475 476* The task may be direct-dispatched to a local DSQ from ``ops.enqueue()``, 477 in which case ``ops.dispatch()`` and ``ops.dequeue()`` are skipped and we go 478 straight to ``ops.running()``. 479 480* Property changes may occur at virtually any point during the task's lifecycle, 481 not just when the task is queued and waiting to be dispatched. For example, 482 changing a property of a running task will lead to the callback sequence 483 ``ops.stopping()`` -> ``ops.quiescent()`` -> (property change callback) -> 484 ``ops.runnable()`` -> ``ops.running()``. 485 486* A sched_ext task can be preempted by a task from a higher-priority scheduling 487 class, in which case it will exit the tick-dispatch loop even though it is runnable 488 and has a non-zero slice. 489 490See the "Scheduling Cycle" section for a more detailed description of how 491a freshly woken up task gets on a CPU. 492 493Where to Look 494============= 495 496* ``include/linux/sched/ext.h`` defines the core data structures, ops table 497 and constants. 498 499* ``kernel/sched/ext/ext.c`` contains sched_ext core implementation and helpers. 500 The functions prefixed with ``scx_bpf_`` can be called from the BPF 501 scheduler. 502 503* ``kernel/sched/ext/idle.c`` contains the built-in idle CPU selection policy. 504 505* ``tools/sched_ext/`` hosts example BPF scheduler implementations. 506 507 * ``scx_simple[.bpf].c``: Minimal global FIFO scheduler example using a 508 custom DSQ. 509 510 * ``scx_qmap[.bpf].c``: A multi-level FIFO scheduler supporting five 511 levels of priority implemented with arena-backed doubly-linked lists. 512 513 * ``scx_central[.bpf].c``: A central FIFO scheduler where all scheduling 514 decisions are made on one CPU, demonstrating ``LOCAL_ON`` dispatching, 515 tickless operation, and kthread preemption. 516 517 * ``scx_cpu0[.bpf].c``: A scheduler that queues all tasks to a shared DSQ 518 and only dispatches them on CPU0 in FIFO order. Useful for testing bypass 519 behavior. 520 521 * ``scx_flatcg[.bpf].c``: A flattened cgroup hierarchy scheduler 522 implementing hierarchical weight-based cgroup CPU control by compounding 523 each cgroup's share at every level into a single flat scheduling layer. 524 525 * ``scx_pair[.bpf].c``: A core-scheduling example that always makes 526 sibling CPU pairs execute tasks from the same CPU cgroup. 527 528 * ``scx_sdt[.bpf].c``: A variation of ``scx_simple`` demonstrating BPF 529 arena memory management for per-task data. 530 531 * ``scx_userland[.bpf].c``: A minimal scheduler demonstrating user space 532 scheduling. Tasks with CPU affinity are direct-dispatched in FIFO order; 533 all others are scheduled in user space by a simple vruntime scheduler. 534 535Module Parameters 536================= 537 538sched_ext exposes two module parameters under the ``sched_ext.`` prefix that 539control bypass-mode behaviour. These knobs are primarily for debugging; there 540is usually no reason to change them during normal operation. They can be read 541and written at runtime (mode 0600) via 542``/sys/module/sched_ext/parameters/``. 543 544``sched_ext.slice_bypass_us`` (default: 5000 µs) 545 The time slice assigned to all tasks when the scheduler is in bypass mode, 546 i.e. during BPF scheduler load, unload, and error recovery. Valid range is 547 100 µs to 100 ms. 548 549``sched_ext.bypass_lb_intv_us`` (default: 500000 µs) 550 The interval at which the bypass-mode load balancer redistributes tasks 551 across CPUs. Set to 0 to disable load balancing during bypass mode. Valid 552 range is 0 to 10 s. 553 554ABI Instability 555=============== 556 557The APIs provided by sched_ext to BPF schedulers programs have no stability 558guarantees. This includes the ops table callbacks and constants defined in 559``include/linux/sched/ext.h``, as well as the ``scx_bpf_`` kfuncs defined in 560``kernel/sched/ext/ext.c`` and ``kernel/sched/ext/idle.c``. 561 562While we will attempt to provide a relatively stable API surface when 563possible, they are subject to change without warning between kernel 564versions. 565