Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
294 commits
Select commit Hold shift + click to select a range
3b0b287
sched_ext: Make scx_bpf_reenqueue_local() skip tasks that are being m…
htejun Jul 9, 2024
eb43577
sched: Move struct balance_callback definition upward
htejun Jul 12, 2024
65b3619
sched_ext: Open-code task_linked_on_dsq()
htejun Jul 12, 2024
1bd42ab
sched_ext: Unpin and repin rq lock from balance_scx()
htejun Jul 12, 2024
e9b271a
sched_ext: s/SCX_RQ_BALANCING/SCX_RQ_IN_BALANCE/ and add SCX_RQ_IN_WA…
htejun Jul 12, 2024
ab357fd
sched_ext: Allow SCX_DSQ_LOCAL_ON for direct dispatches
htejun Jul 12, 2024
7b230b8
sched_ext/scx_qmap: Pick idle CPU for direct dispatch on !wakeup enqu…
htejun Jul 12, 2024
5dd96b1
sched_ext: Fixes incorrect type in bpf_scx_init()
wb-zjp846396 Jul 15, 2024
cea4782
scx: Allow calling sleepable kfuncs from BPF_PROG_TYPE_SYSCALL
ByteLab-David Jul 31, 2024
0102ec9
scx/selftests: Verify we can call create_dsq from prog_run
ByteLab-David Jul 31, 2024
663a43d
sched_ext: Build fix on !CONFIG_STACKTRACE[_SUPPORT]
htejun Jul 31, 2024
2212ab0
sched_ext: Allow p->scx.disallow only while loading
htejun Aug 1, 2024
3357711
sched_ext: Simplify scx_can_stop_tick() invocation in sched_can_stop_…
htejun Aug 6, 2024
288b106
sched_ext: Add scx_enabled() test to @start_class promotion in put_pr…
htejun Aug 6, 2024
cf7371b
sched_ext: Use update_curr_common() in update_curr_scx()
htejun Aug 6, 2024
93de1c6
sched_ext: Simplify UP support by enabling sched_class->balance() in UP
htejun Aug 6, 2024
6078a3d
sched_ext: Improve comment on idle_sched_class exception in scx_task_…
htejun Aug 6, 2024
43b1760
sched_ext: Make task_can_run_on_remote_rq() use common task_allowed_o…
htejun Aug 6, 2024
abdd763
sched_ext: Fix unsafe list iteration in process_ddsp_deferred_locals()
htejun Aug 7, 2024
90b2f0b
sched_ext: Make scx_rq_online() also test cpu_active() in addition to…
htejun Aug 7, 2024
adec8c9
sched_ext: Improve logging around enable/disable
htejun Aug 8, 2024
4a24b4c
sched_ext: define missing cfi stubs for sched_ext
chantra Aug 13, 2024
1e12901
sched_ext: Don't use double locking to migrate tasks across CPUs
htejun Aug 7, 2024
e1eeea2
sched_ext: Allow dequeue_task_scx to fail
Aug 20, 2024
182d3e8
scx_central: Fix smatch checker warning
htejun Aug 27, 2024
04747da
sched_ext: Add missing cfi stub for ops.tick
htejun Aug 28, 2024
14a3113
sched_ext: Use task_can_run_on_remote_rq() test in dispatch_to_local_…
htejun Aug 30, 2024
f0d6e6b
sched_ext: Use sched_clock_cpu() instead of rq_clock_task() in touch_…
htejun Aug 30, 2024
5709d82
sched: Use set_next_task(.first) where required
Aug 13, 2024
e71695d
sched: Fixup set_next_task() implementations
Aug 13, 2024
c5fc63d
sched: Split up put_prev_task_balance()
Aug 13, 2024
8e63489
sched: Rework pick_next_task()
Aug 13, 2024
d7fc095
sched: Combine the last put_prev_task() and the first set_next_task()
Aug 13, 2024
ea75d28
sched: Add put_prev_task(.next)
Aug 13, 2024
61397b8
sched_ext: Don't call put_prev_task_scx() before picking the next task
htejun Sep 4, 2024
c74cdce
sched_ext: Replace SCX_TASK_BAL_KEEP with SCX_RQ_BAL_KEEP
htejun Sep 4, 2024
ab1fa46
sched_ext: Unify regular and core-sched pick task paths
htejun Sep 4, 2024
eace1a8
sched_ext: Relocate functions in kernel/sched/ext.c
htejun Sep 4, 2024
be75dfd
sched_ext: Remove switch_class_scx()
htejun Sep 4, 2024
ba7e8cd
sched_ext: Remove sched_class->switch_class()
htejun Sep 4, 2024
ad10f5b
sched_ext: TASK_DEAD tasks must be switched out of SCX on ops_disable
htejun Aug 30, 2024
e371b0a
sched_ext: TASK_DEAD tasks must be switched into SCX on ops_enable
htejun Aug 31, 2024
c39f971
sched: Expose css_tg()
htejun Sep 4, 2024
cd8a8ce
sched: Make cpu_shares_read_u64() use tg_weight()
htejun Sep 4, 2024
db05de1
sched: Introduce CONFIG_GROUP_SCHED_WEIGHT
htejun Sep 4, 2024
6335fb8
sched_ext: Add cgroup support
htejun Sep 4, 2024
d061495
sched_ext: Add a cgroup scheduler which uses flattened hierarchy
htejun Sep 4, 2024
34bc5d4
sched_ext: Temporarily work around pick_task_scx() being called witho…
htejun Sep 6, 2024
5206a5d
sched_ext: Add missing static to scx_has_op[]
htejun Sep 6, 2024
b153759
sched_ext: Add missing static to scx_dump_data
htejun Sep 7, 2024
547cfff
sched_ext: Rename scx_kfunc_set_sleepable to unlocked and relocate
htejun Sep 9, 2024
4fb8706
sched_ext: Refactor consume_remote_task()
htejun Sep 9, 2024
37e51a5
sched_ext: Make find_dsq_for_dispatch() handle SCX_DSQ_LOCAL_ON
htejun Sep 9, 2024
0b4fd27
sched_ext: Fix processs_ddsp_deferred_locals() by unifying DTL_INVALI…
htejun Sep 9, 2024
68a9cd8
sched_ext: Restructure dispatch_to_local_dsq()
htejun Sep 9, 2024
ad12c78
sched_ext: Reorder args for consume_local/remote_task()
htejun Sep 9, 2024
c022482
sched_ext: Move sanity check and dsq_mod_nr() into task_unlink_from_d…
htejun Sep 9, 2024
1142479
sched_ext: Move consume_local_task() upward
htejun Sep 9, 2024
59d9d95
sched_ext: Replace consume_local_task() with move_local_task_to_local…
htejun Sep 9, 2024
40f9a66
sched_ext: Compact struct bpf_iter_scx_dsq_kern
htejun Sep 9, 2024
c029664
sched_ext: Implement scx_bpf_dispatch[_vtime]_from_dsq()
htejun Sep 9, 2024
a472f44
scx_qmap: Implement highpri boosting
htejun Sep 9, 2024
6a7b35a
sched_ext: Synchronize bypass state changes with rq lock
htejun Sep 9, 2024
bef8611
sched_ext: Don't trigger ops.quiescent/runnable() on migrations
htejun Sep 9, 2024
75f243f
bpf: Add __bpf_kfunc_{start,end}_defs macros
davemarchevsky Oct 31, 2023
b481563
bpf: Add __bpf_hook_{start,end} macros
davemarchevsky Oct 31, 2023
e13d1a7
bpf: teach the verifier to enforce css_iter and task_iter in RCU CS
kchuyizhou Oct 18, 2023
02fb21e
bpf: move sleepable flag from bpf_prog_aux to bpf_prog
anakryiko Mar 9, 2024
725f99c
bpf: make struct_ops_map support btfs other than btf_vmlinux.
ThinkerYzu1 Jan 19, 2024
f75569b
bpf: Create argument information for nullable arguments.
ThinkerYzu1 Feb 9, 2024
a79d3c2
bpf: Check cfi_stubs before registering a struct_ops type.
ThinkerYzu1 Feb 22, 2024
5a77b66
bpf, net: validate struct_ops when updating value.
ThinkerYzu1 Feb 24, 2024
e7d0d0c
bpf: pass bpf_struct_ops_link to callbacks in bpf_struct_ops.
ThinkerYzu1 May 30, 2024
ef6aba3
bpf: enable detaching links of struct_ops objects.
ThinkerYzu1 May 30, 2024
7ca9d8a
bpf: support epoll from bpf struct_ops links.
ThinkerYzu1 May 30, 2024
7501991
bpf: Replace 8 seq_puts() calls by seq_putc() calls
elfring Jul 14, 2024
4070d06
bpf: Check unsupported ops from the bpf_struct_ops's cfi_stubs
Jul 22, 2024
0c5224a
sched: Fix delayed_dequeue vs switched_from_fair()
Oct 10, 2024
fd1f988
bpf: add btf pointer to struct bpf_ctx_arg_aux.
ThinkerYzu1 Feb 9, 2024
5dbaae5
sched/ext: Remove sched_fork() hack
KAGA-KOKO Oct 28, 2024
b98b1d0
sched_ext: scx_bpf_dispatch_from_dsq_set_*() are allowed from unlocke…
htejun Nov 9, 2024
b4f3fc9
sched_ext: add a missing rcu_read_lock/unlock pair at scx_select_cpu_…
multics69 Nov 9, 2024
8ccbacf
sched_ext: Fix invalid irq restore in scx_ops_bypass()
htejun Dec 11, 2024
290e4c0
sched_ext: initialize kit->cursor.flags
Dec 22, 2024
11128f5
sched_ext: Replace rq_lock() to raw_spin_rq_lock() in scx_ops_bypass()
multics69 Jan 8, 2025
09669a4
sched_ext: switch class when preempted by higher priority scheduler
redsky110 Jan 8, 2025
a18ce93
sched_ext: idle: Refresh idle masks during idle-to-idle transitions
arighi Jan 10, 2025
bee3791
sched_ext: keep running prev when prev->scx.slice != 0
Jan 8, 2025
248b909
sched_ext: Fix lock imbalance in dispatch_to_local_dsq()
arighi Jan 27, 2025
6fca668
sched_ext: Use SCX_CALL_OP_TASK in task_tick_scx
kchuyizhou Feb 12, 2025
d519d56
sched_ext: Fix incorrect autogroup migration detection
htejun Jan 24, 2025
05b07e5
sched_ext: Factor out move_task_between_dsqs() from scx_dispatch_from…
htejun Sep 25, 2024
51e5296
sched_ext: Fix migration disabled handling in targeted dispatches
htejun Feb 7, 2025
879b8ef
sched_ext: Fix incorrect assumption about migration disabled tasks in…
htejun Feb 10, 2025
a99d32b
sched_ext: Fix build when !CONFIG_STACKTRACE
htejun Sep 23, 2024
5a6df37
sched_ext: Provide a sysfs enable_seq counter
arighi Sep 21, 2024
d4c487d
sched_ext: Build fix for !CONFIG_SMP
htejun Sep 24, 2024
598e2bc
sched_ext: Allow only user DSQs for scx_bpf_consume(), scx_bpf_dsq_nr…
htejun Sep 26, 2024
6da645d
sched_ext: Relocate find_user_dsq()
htejun Sep 26, 2024
a79b0c9
sched_ext: Split the global DSQ per NUMA node
htejun Sep 26, 2024
d6e380d
sched_ext: Use shorter slice while bypassing
htejun Sep 26, 2024
869aaa7
sched_ext: Relocate check_hotplug_seq() call in scx_ops_enable()
htejun Sep 27, 2024
d822774
sched_ext: Remove SCX_OPS_PREPPING
htejun Sep 27, 2024
7c44d72
sched_ext: Initialize in bypass mode
htejun Sep 27, 2024
5df9242
sched_ext: Fix SCX_TASK_INIT -> SCX_TASK_READY transitions in scx_ops…
htejun Sep 27, 2024
b5a2151
sched_ext: Enable scx_ops_init_task() separately
htejun Sep 27, 2024
1654956
sched_ext: Add scx_cgroup_enabled to gate cgroup operations and fix s…
htejun Sep 27, 2024
2efa5a0
sched_ext: Decouple locks in scx_ops_disable_workfn()
htejun Sep 27, 2024
c582c39
sched_ext: Decouple locks in scx_ops_enable()
htejun Sep 27, 2024
1574f9f
sched_ext: Remove redundant p->nr_cpus_allowed checker
Sep 26, 2024
463519c
sched_ext: Improve error reporting during loading
htejun Oct 2, 2024
0bfe28f
sched_ext: scx_cgroup_exit() may be called without successful scx_cgr…
htejun Oct 2, 2024
7fef039
sched_ext, scx_qmap: Add and use SCX_ENQ_CPU_SELECTED
htejun Sep 27, 2024
04601c3
sched_ext: use correct function name in pick_task_scx() warning message
redsky110 Oct 10, 2024
81f1e5b
Revert "sched_ext: Use shorter slice while bypassing"
htejun Oct 10, 2024
a0fff45
sched_ext: Move scx_buildin_idle_enabled check to scx_bpf_select_cpu_…
htejun Oct 10, 2024
4a3d3d0
sched_ext: bypass mode shouldn't depend on ops.select_cpu()
htejun Oct 10, 2024
9232cc4
sched_ext: Move scx_tasks_lock handling into scx_task_iter helpers
htejun Oct 10, 2024
5687ff2
sched_ext: Don't hold scx_tasks_lock for too long
htejun Oct 10, 2024
e18ac62
sched_ext: Remove unnecessary cpu_relax()
ByteLab-David Oct 14, 2024
7054aed
scx: Fix raciness in scx_ops_bypass()
ByteLab-David Oct 25, 2024
1532866
sched: Pass correct scheduling policy to __setscheduler_class
AboorvaDevarajan Oct 25, 2024
d643927
sched/ext: Fix scx vs sched_delayed
Oct 30, 2024
cdb44a8
sched_ext: Add a missing newline at the end of an error message
htejun Nov 5, 2024
92cb5b9
sched_ext: Handle cases where pick_task_scx() is called without prece…
htejun Nov 9, 2024
e682267
sched_ext: ops.cpu_acquire() should be called with SCX_KF_REST
htejun Nov 14, 2024
50dfcb4
sched_ext: Fix pick_task_scx() picking non-queued tasks when it's cal…
htejun Feb 25, 2025
da7d0aa
sched_ext: Validate prev_cpu in scx_bpf_select_cpu_dfl()
arighi Mar 3, 2025
52f60f0
sched_ext: create_dsq: Return -EEXIST on duplicate request
JakeHillion Mar 25, 2025
c307ae9
sched_ext: Use kvzalloc for large exit_dump allocation
leitao Apr 8, 2025
5285b36
sched_ext: bpf_iter_scx_dsq_new() should always initialize iterator
htejun May 5, 2025
0b5492f
sched_ext, sched/core: Don't call scx_group_set_weight() prematurely …
htejun Jun 16, 2025
4f802b6
sched_ext: Make scx_group_set_weight() always update tg->scx.weight
htejun Jul 6, 2025
9be65d0
sched/ext: Fix invalid task state transitions on class switch
arighi Aug 5, 2025
62b123f
sched_ext: initialize built-in idle state before ops.init()
arighi Mar 25, 2025
521458a
sched_ext: Mark scx_bpf_dsq_move_set_[slice|vtime]() with KF_RCU
htejun Nov 2, 2025
c33696e
sched_ext: Fix unsafe locking in the scx_dump_state()
Nov 12, 2025
6152153
sched_ext: Fix incorrect sched_class settings for per-cpu migration t…
Dec 29, 2025
3e13e6e
sched_ext: Factor out local_dsq_post_enq() from dispatch_enqueue()
htejun Jan 2, 2026
69071ad
sched_ext: Fix missing post-enqueue handling in move_local_task_to_lo…
htejun Jan 2, 2026
9b02a81
sched_ext: Fix possible deadlock in the deferred_irq_workfn()
Jan 23, 2026
df5cc51
sched_ext: Disable preemption between scx_claim_exit() and kicking he…
htejun Mar 17, 2026
cfdcd01
sched_ext: Fix starvation of scx_enable() under fair-class saturation
htejun Mar 18, 2026
b491e50
sched_ext: Remove redundant css_put() in scx_cgroup_init()
EricccTaiwan Mar 3, 2026
c54d63b
sched_ext: Use WRITE_ONCE() for the write side of dsq->seq update
soolaugust Mar 4, 2026
825e7b8
sched_ext: Fix stale direct dispatch state in ddsp_dsq_id
arighi Apr 8, 2026
051a7ef
sched_ext: Guard scx_dsq_move() against NULL kit->dsq after failed it…
htejun May 18, 2026
34118bb
sched_ext: Fix missing warning in scx_set_task_state() default case
samuele-mariotti May 21, 2026
87b5a0a
sched_ext: Avoid UAF in scx_root_enable_workfn() init failure path
htejun May 21, 2026
f842163
sched_ext: Don't warn on NULL cgrp_moving_from in scx_cgroup_move_task()
htejun Jun 15, 2026
bd4af09
sched_ext: Fix inverted ops.core_sched_before() invocation
htejun Sep 9, 2026
7d313e0
sched/core: Make select_task_rq() take the pointer to wake_flags inst…
htejun Sep 27, 2024
e1693f5
sched/core: Add ENQUEUE_RQ_SELECTED to indicate whether ->select_task…
htejun Sep 27, 2024
bfa62a2
bpf: derive smin/smax from umin/max bounds
anakryiko Nov 2, 2023
3a9531c
bpf: derive smin32/smax32 from umin32/umax32 bounds
anakryiko Nov 2, 2023
deceb46
bpf: derive subreg bounds from full bounds when upper 32 bits are con…
anakryiko Nov 2, 2023
23ee097
bpf: add special smin32/smax32 derivation from 64-bit bounds
anakryiko Nov 2, 2023
d26402f
bpf: improve deduction of 64-bit bounds from 32-bit bounds
anakryiko Nov 2, 2023
17d40b2
bpf: try harder to deduce register bounds from different numeric domains
anakryiko Nov 2, 2023
1b69e1e
bpf: drop knowledge-losing __reg_combine_{32,64}_into_{64,32} logic
anakryiko Nov 2, 2023
e963be3
bpf: Improve JEQ/JNE branch taken logic
anakryiko Oct 22, 2023
f934dbb
bpf: rename is_branch_taken reg arguments to prepare for the second one
anakryiko Nov 2, 2023
f6b2040
bpf: generalize is_branch_taken() to work with two registers
anakryiko Nov 2, 2023
71905f9
bpf: move is_branch_taken() down
anakryiko Nov 2, 2023
a93f235
bpf: generalize is_branch_taken to handle all conditional jumps in on…
anakryiko Nov 2, 2023
6ca675b
bpf: unify 32-bit and 64-bit is_branch_taken logic
anakryiko Nov 2, 2023
d0d8caf
bpf: prepare reg_set_min_max for second set of registers
anakryiko Nov 2, 2023
971050c
bpf: generalize reg_set_min_max() to handle two sets of two registers
anakryiko Nov 2, 2023
7f79d14
bpf: generalize reg_set_min_max() to handle non-const register compar…
anakryiko Nov 12, 2023
48c3dd3
bpf: Forget ranges when refining tnum after JSET
pchaigno Jul 10, 2025
29f726f
bpf: generalize is_scalar_branch_taken() logic
anakryiko Nov 12, 2023
f16303e
bpf: enhance BPF_JEQ/BPF_JNE is_branch_taken logic
anakryiko Nov 12, 2023
9f418e1
bpf: add register bounds sanity checks and sanitization
anakryiko Nov 12, 2023
cd4855b
bpf: remove redundant s{32,64} -> u{32,64} deduction logic
anakryiko Nov 12, 2023
5bcff78
bpf: make __reg{32,64}_deduce_bounds logic more robust
anakryiko Nov 12, 2023
112e9b2
bpf: make the verifier tracks the "not equal" for regs
image-dragon Dec 19, 2023
b163a68
bpf: Fix reg_set_min_max corruption of fake_reg
borkmann Jun 13, 2024
1114126
bpf: abstract away global subprog arg preparation logic from reg stat…
anakryiko Dec 15, 2023
a5ed265
bpf: reuse btf_prepare_func_args() check for main program BTF validation
anakryiko Dec 15, 2023
006a740
bpf: prepare btf_prepare_func_args() for handling static subprogs
anakryiko Dec 15, 2023
5ca5bcd
bpf: move subprog call logic back to verifier.c
anakryiko Dec 15, 2023
14b6614
bpf: reuse subprog argument parsing logic for subprog call checks
anakryiko Dec 15, 2023
a65346c
bpf: support 'arg:xxx' btf_decl_tag-based hints for global subprog args
anakryiko Dec 15, 2023
b9d7b95
bpf: add support for passing dynptr pointer to global subprog
anakryiko Dec 15, 2023
9f0b8c1
bpf: make sure scalar args don't accept __arg_nonnull tag
anakryiko Jan 5, 2024
ac5fd13
bpf: prepare btf_prepare_func_args() for multiple tags per argument
anakryiko Jan 5, 2024
4ad82b7
bpf: support multiple tags per argument
anakryiko Jan 5, 2024
6167fff
bpf: enforce types for __arg_ctx-tagged arguments in global subprogs
anakryiko Jan 18, 2024
8ee769b
bpf: extract bpf_ctx_convert_map logic and make it more reusable
anakryiko Jan 18, 2024
263e204
bpf: don't infer PTR_TO_CTX for programs with unnamed context type
anakryiko Feb 12, 2024
3470b45
bpf: move arg:ctx type enforcement check inside the main logic loop
anakryiko Jan 25, 2024
dd308e2
bpf: add __arg_trusted global func arg tag
anakryiko Jan 30, 2024
68c1b2d
bpf: add arg:nullable tag to be combined with trusted pointers
anakryiko Jan 30, 2024
39c7c7a
bpf: handle trusted PTR_TO_BTF_ID_OR_NULL in argument check logic
anakryiko Feb 2, 2024
a9df263
bpf: don't emit warnings intended for global subprogs for static subp…
anakryiko Feb 2, 2024
9ccd639
bpf: Add bpf_cpumask_weight() kfunc
ByteLab-David Dec 7, 2023
9d39381
bpf: Allow invoking kfuncs from BPF_PROG_TYPE_SYSCALL progs
ByteLab-David Apr 5, 2024
5a42df3
bpf: Make perf_event_read_output accessible in all program types.
etsal Mar 18, 2025
08e9494
mm: Introduce VM_SPARSE kind and vm_area_[un]map_pages().
Mar 5, 2024
7427e54
bpf: Introduce bpf_arena.
Mar 8, 2024
dab418e
bpf: Plumb get_unmapped_area() callback into bpf_map_ops
Mar 7, 2024
ba41a26
bpf: Disasm support for addr_space_cast instruction.
Mar 8, 2024
30d5e8c
bpf: Add x86-64 JIT support for PROBE_MEM32 pseudo instructions.
Mar 8, 2024
a638f64
bpf: Add x86-64 JIT support for bpf_addr_space_cast instruction.
Mar 8, 2024
c943f2c
bpf: Recognize addr_space_cast instruction in the verifier.
Mar 8, 2024
1920eef
bpf: Recognize btf_decl_tag("arg: Arena") as PTR_TO_ARENA.
Mar 8, 2024
65f5969
bpf,arena: Use helper sizeof_field in struct accessors
Mar 27, 2024
5302542
bpf: Temporarily disable atomic operations in BPF arena
puranjaymohan Mar 14, 2024
fa3b5c6
bpf: Add support for certain atomics in bpf_arena to x86 JIT
Apr 5, 2024
8f3303d
bpf: Remove redundant page mask of vmf->address
May 7, 2024
0e358fd
bpf: Fix remap of arena.
Jun 17, 2024
1498a43
bpf: Fix atomic probe zero-extension
iii-i Jul 1, 2024
7c88db2
bpf: Use refcount_t instead of atomic_t for mmap_count
Dec 30, 2024
74450e4
bpf: Fix softlockup in arena_map_free on 64k page kernel
alan-maguire Feb 5, 2025
d955721
bpf: Fix constant blinding for PROBE_MEM32 stores
S4CH Mar 9, 2026
049461e
bpf: Allow instructions with arena source and non-arena dest registers
etsal Apr 12, 2026
edd81c5
bpf: Introduce may_goto instruction
Mar 6, 2024
d48c566
bpf: Recognize that two registers are safe when their ranges match
Mar 6, 2024
8643203
bpf: Fix the corner case with may_goto and jump to the 1st insn.
Jun 19, 2024
987e5ed
bpf: Fix may_goto with negative offset.
Jun 19, 2024
c0e9e85
bpf: fix overflow check in adjust_jmp_off()
shunghsiyu Jul 12, 2024
245f858
bpf: Fix array bounds error with may_goto
mrpre Feb 14, 2025
12a5afd
bpf: copy_verifier_state() should copy 'loop_entry' field
eddyz87 Feb 15, 2025
b2066f9
bpf: Recognize '__map' suffix in kfunc arguments
Mar 7, 2024
b7a5ddf
bpf: Allow kfuncs return 'void *'
Mar 7, 2024
102d01b
bpf: Allow calling static subprogs while holding a bpf_spin_lock
kkdwvd Feb 4, 2024
2bb45d5
bpf: Transfer RCU lock state between subprog calls
kkdwvd Feb 5, 2024
849e4fc
bpf: Introduce bpf_preempt_[disable,enable] kfuncs
kkdwvd Apr 24, 2024
2c40d5a
bpf: Tighten tail call checks for lingering locks, RCU, preempt_disable
kkdwvd Nov 3, 2024
1773211
bpf: add a get_helper_proto() utility function
eddyz87 Jul 22, 2024
9fadc1d
bpf: Summarize sleepable global subprogs
kkdwvd Mar 1, 2025
f9dcc3f
bpf: extract iterator argument type and name validation logic
anakryiko Aug 8, 2024
458013c
bpf: allow passing struct bpf_iter_<type> as kfunc arguments
anakryiko Aug 8, 2024
d87e1eb
bpf: Zero index arg error string for dynptr and iter
kkdwvd Dec 3, 2024
96090c9
bpf: Check the helper function is valid in get_helper_proto
olsajiri Aug 14, 2025
7a57789
bpf/verifier: replace calls to mark_reg_unknown.
cupermir May 6, 2024
1b08f6b
bpf/verifier: refactor checks for range computation
cupermir May 6, 2024
53c4bba
bpf/verifier: improve XOR and OR range computation
cupermir May 6, 2024
24d3895
bpf: Fix a kernel verifier crash in stacksafe()
Aug 12, 2024
d0a0feb
bpf: Allow helper bpf_get_[ns_]current_pid_tgid() for all prog types
Mar 15, 2024
fb73847
deepin: config: enable sched_ext
LFRon Sep 26, 2026
88cba2d
sched_ext: Avoid live-locking bypass mode switching
htejun Nov 5, 2024
6e73e17
sched_ext: Enable the ops breather and eject BPF scheduler on softlockup
htejun Nov 5, 2024
c655cbe
sched_ext: scx_bpf_dispatch_from_dsq_set_*() are allowed from unlocke…
htejun Nov 9, 2024
b6c0a23
sched_ext: Rename scx_bpf_dispatch[_vtime]() to scx_bpf_dsq_insert[_v…
htejun Nov 11, 2024
6d918f1
sched_ext: Rename scx_bpf_consume() to scx_bpf_dsq_move_to_local()
htejun Nov 11, 2024
7288b2c
sched_ext: Rename scx_bpf_dispatch[_vtime]_from_dsq*() -> scx_bpf_dsq…
htejun Nov 11, 2024
a2d3fed
sched_ext: Implement scx_bpf_now()
multics69 Jan 9, 2025
e768d86
sched_ext: Add scx_bpf_now() for BPF scheduler
multics69 Jan 9, 2025
3f88320
bpf: struct_ops supports more than one page for trampolines.
ThinkerYzu1 Feb 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Documentation/bpf/cpumasks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ can be used to query the contents of cpumasks.

.. kernel-doc:: kernel/bpf/cpumask.c
:identifiers: bpf_cpumask_first bpf_cpumask_first_zero bpf_cpumask_first_and
bpf_cpumask_test_cpu
bpf_cpumask_test_cpu bpf_cpumask_weight

.. kernel-doc:: kernel/bpf/cpumask.c
:identifiers: bpf_cpumask_equal bpf_cpumask_intersects bpf_cpumask_subset
Expand Down
6 changes: 2 additions & 4 deletions Documentation/bpf/kfuncs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,14 @@ prototype in a header for the wrapper kfunc.
An example is given below::

/* Disables missing prototype warnings */
__diag_push();
__diag_ignore_all("-Wmissing-prototypes",
"Global kfuncs as their definitions will be in BTF");
__bpf_kfunc_start_defs();

__bpf_kfunc struct task_struct *bpf_find_get_task_by_vpid(pid_t nr)
{
return find_get_task_by_vpid(nr);
}

__diag_pop();
__bpf_kfunc_end_defs();

A wrapper kfunc is often needed when we need to annotate parameters of the
kfunc. Otherwise one may directly make the kfunc visible to the BPF program by
Expand Down
1 change: 1 addition & 0 deletions Documentation/scheduler/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Scheduler
sched-nice-design
sched-rt-group
sched-stats
sched-ext
sched-debug

text_files
Expand Down
325 changes: 325 additions & 0 deletions Documentation/scheduler/sched-ext.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,325 @@
==========================
Extensible Scheduler Class
==========================

sched_ext is a scheduler class whose behavior can be defined by a set of BPF
programs - the BPF scheduler.

* sched_ext exports a full scheduling interface so that any scheduling
algorithm can be implemented on top.

* The BPF scheduler can group CPUs however it sees fit and schedule them
together, as tasks aren't tied to specific CPUs at the time of wakeup.

* The BPF scheduler can be turned on and off dynamically anytime.

* The system integrity is maintained no matter what the BPF scheduler does.
The default scheduling behavior is restored anytime an error is detected,
a runnable task stalls, or on invoking the SysRq key sequence
:kbd:`SysRq-S`.

* When the BPF scheduler triggers an error, debug information is dumped to
aid debugging. The debug dump is passed to and printed out by the
scheduler binary. The debug dump can also be accessed through the
`sched_ext_dump` tracepoint. The SysRq key sequence :kbd:`SysRq-D`
triggers a debug dump. This doesn't terminate the BPF scheduler and can
only be read through the tracepoint.

Switching to and from sched_ext
===============================

``CONFIG_SCHED_CLASS_EXT`` is the config option to enable sched_ext and
``tools/sched_ext`` contains the example schedulers. The following config
options should be enabled to use sched_ext:

.. code-block:: none

CONFIG_BPF=y
CONFIG_SCHED_CLASS_EXT=y
CONFIG_BPF_SYSCALL=y
CONFIG_BPF_JIT=y
CONFIG_DEBUG_INFO_BTF=y
CONFIG_BPF_JIT_ALWAYS_ON=y
CONFIG_BPF_JIT_DEFAULT_ON=y
CONFIG_PAHOLE_HAS_SPLIT_BTF=y
CONFIG_PAHOLE_HAS_BTF_TAG=y

sched_ext is used only when the BPF scheduler is loaded and running.

If a task explicitly sets its scheduling policy to ``SCHED_EXT``, it will be
treated as ``SCHED_NORMAL`` and scheduled by CFS until the BPF scheduler is
loaded.

When the BPF scheduler is loaded and ``SCX_OPS_SWITCH_PARTIAL`` is not set
in ``ops->flags``, all ``SCHED_NORMAL``, ``SCHED_BATCH``, ``SCHED_IDLE``, and
``SCHED_EXT`` tasks are scheduled by sched_ext.

However, when the BPF scheduler is loaded and ``SCX_OPS_SWITCH_PARTIAL`` is
set in ``ops->flags``, only tasks with the ``SCHED_EXT`` policy are scheduled
by sched_ext, while tasks with ``SCHED_NORMAL``, ``SCHED_BATCH`` and
``SCHED_IDLE`` policies are scheduled by CFS.

Terminating the sched_ext scheduler program, triggering :kbd:`SysRq-S`, or
detection of any internal error including stalled runnable tasks aborts the
BPF scheduler and reverts all tasks back to CFS.

.. code-block:: none

# make -j16 -C tools/sched_ext
# tools/sched_ext/scx_simple
local=0 global=3
local=5 global=24
local=9 global=44
local=13 global=56
local=17 global=72
^CEXIT: BPF scheduler unregistered

The current status of the BPF scheduler can be determined as follows:

.. code-block:: none

# cat /sys/kernel/sched_ext/state
enabled
# cat /sys/kernel/sched_ext/root/ops
simple

You can check if any BPF scheduler has ever been loaded since boot by examining
this monotonically incrementing counter (a value of zero indicates that no BPF
scheduler has been loaded):

.. code-block:: none

# cat /sys/kernel/sched_ext/enable_seq
1

``tools/sched_ext/scx_show_state.py`` is a drgn script which shows more
detailed information:

.. code-block:: none

# tools/sched_ext/scx_show_state.py
ops : simple
enabled : 1
switching_all : 1
switched_all : 1
enable_state : enabled (2)
bypass_depth : 0
nr_rejected : 0
enable_seq : 1

If ``CONFIG_SCHED_DEBUG`` is set, whether a given task is on sched_ext can
be determined as follows:

.. code-block:: none

# grep ext /proc/self/sched
ext.enabled : 1

The Basics
==========

Userspace can implement an arbitrary BPF scheduler by loading a set of BPF
programs that implement ``struct sched_ext_ops``. The only mandatory field
is ``ops.name`` which must be a valid BPF object name. All operations are
optional. The following modified excerpt is from
``tools/sched_ext/scx_simple.bpf.c`` showing a minimal global FIFO scheduler.

.. code-block:: c

/*
* Decide which CPU a task should be migrated to before being
* enqueued (either at wakeup, fork time, or exec time). If an
* idle core is found by the default ops.select_cpu() implementation,
* then insert the task directly into SCX_DSQ_LOCAL and skip the
* ops.enqueue() callback.
*
* Note that this implementation has exactly the same behavior as the
* default ops.select_cpu implementation. The behavior of the scheduler
* would be exactly same if the implementation just didn't define the
* simple_select_cpu() struct_ops prog.
*/
s32 BPF_STRUCT_OPS(simple_select_cpu, struct task_struct *p,
s32 prev_cpu, u64 wake_flags)
{
s32 cpu;
/* Need to initialize or the BPF verifier will reject the program */
bool direct = false;

cpu = scx_bpf_select_cpu_dfl(p, prev_cpu, wake_flags, &direct);

if (direct)
scx_bpf_dsq_insert(p, SCX_DSQ_LOCAL, SCX_SLICE_DFL, 0);

return cpu;
}

/*
* Do a direct insertion of a task to the global DSQ. This ops.enqueue()
* callback will only be invoked if we failed to find a core to insert
* into in ops.select_cpu() above.
*
* Note that this implementation has exactly the same behavior as the
* default ops.enqueue implementation, which just dispatches the task
* to SCX_DSQ_GLOBAL. The behavior of the scheduler would be exactly same
* if the implementation just didn't define the simple_enqueue struct_ops
* prog.
*/
void BPF_STRUCT_OPS(simple_enqueue, struct task_struct *p, u64 enq_flags)
{
scx_bpf_dsq_insert(p, SCX_DSQ_GLOBAL, SCX_SLICE_DFL, enq_flags);
}

s32 BPF_STRUCT_OPS_SLEEPABLE(simple_init)
{
/*
* By default, all SCHED_EXT, SCHED_OTHER, SCHED_IDLE, and
* SCHED_BATCH tasks should use sched_ext.
*/
return 0;
}

void BPF_STRUCT_OPS(simple_exit, struct scx_exit_info *ei)
{
exit_type = ei->type;
}

SEC(".struct_ops")
struct sched_ext_ops simple_ops = {
.select_cpu = (void *)simple_select_cpu,
.enqueue = (void *)simple_enqueue,
.init = (void *)simple_init,
.exit = (void *)simple_exit,
.name = "simple",
};

Dispatch Queues
---------------

To match the impedance between the scheduler core and the BPF scheduler,
sched_ext uses DSQs (dispatch queues) which can operate as both a FIFO and a
priority queue. By default, there is one global FIFO (``SCX_DSQ_GLOBAL``),
and one local dsq per CPU (``SCX_DSQ_LOCAL``). The BPF scheduler can manage
an arbitrary number of dsq's using ``scx_bpf_create_dsq()`` and
``scx_bpf_destroy_dsq()``.

A CPU always executes a task from its local DSQ. A task is "inserted" into a
DSQ. A task in a non-local DSQ is "move"d into the target CPU's local DSQ.

When a CPU is looking for the next task to run, if the local DSQ is not
empty, the first task is picked. Otherwise, the CPU tries to move a task
from the global DSQ. If that doesn't yield a runnable task either,
``ops.dispatch()`` is invoked.

Scheduling Cycle
----------------

The following briefly shows how a waking task is scheduled and executed.

1. When a task is waking up, ``ops.select_cpu()`` is the first operation
invoked. This serves two purposes. First, CPU selection optimization
hint. Second, waking up the selected CPU if idle.

The CPU selected by ``ops.select_cpu()`` is an optimization hint and not
binding. The actual decision is made at the last step of scheduling.
However, there is a small performance gain if the CPU
``ops.select_cpu()`` returns matches the CPU the task eventually runs on.

A side-effect of selecting a CPU is waking it up from idle. While a BPF
scheduler can wake up any cpu using the ``scx_bpf_kick_cpu()`` helper,
using ``ops.select_cpu()`` judiciously can be simpler and more efficient.

A task can be immediately inserted into a DSQ from ``ops.select_cpu()``
by calling ``scx_bpf_dsq_insert()``. If the task is inserted into
``SCX_DSQ_LOCAL`` from ``ops.select_cpu()``, it will be inserted into the
local DSQ of whichever CPU is returned from ``ops.select_cpu()``.
Additionally, inserting directly from ``ops.select_cpu()`` will cause the
``ops.enqueue()`` callback to be skipped.

Note that the scheduler core will ignore an invalid CPU selection, for
example, if it's outside the allowed cpumask of the task.

2. Once the target CPU is selected, ``ops.enqueue()`` is invoked (unless the
task was inserted directly from ``ops.select_cpu()``). ``ops.enqueue()``
can make one of the following decisions:

* Immediately insert the task into either the global or local DSQ by
calling ``scx_bpf_dsq_insert()`` with ``SCX_DSQ_GLOBAL`` or
``SCX_DSQ_LOCAL``, respectively.

* Immediately insert the task into a custom DSQ by calling
``scx_bpf_dsq_insert()`` with a DSQ ID which is smaller than 2^63.

* Queue the task on the BPF side.

3. When a CPU is ready to schedule, it first looks at its local DSQ. If
empty, it then looks at the global DSQ. If there still isn't a task to
run, ``ops.dispatch()`` is invoked which can use the following two
functions to populate the local DSQ.

* ``scx_bpf_dsq_insert()`` inserts a task to a DSQ. Any target DSQ can be
used - ``SCX_DSQ_LOCAL``, ``SCX_DSQ_LOCAL_ON | cpu``,
``SCX_DSQ_GLOBAL`` or a custom DSQ. While ``scx_bpf_dsq_insert()``
currently can't be called with BPF locks held, this is being worked on
and will be supported. ``scx_bpf_dsq_insert()`` schedules insertion
rather than performing them immediately. There can be up to
``ops.dispatch_max_batch`` pending tasks.

* ``scx_bpf_move_to_local()`` moves a task from the specified non-local
DSQ to the dispatching DSQ. This function cannot be called with any BPF
locks held. ``scx_bpf_move_to_local()`` flushes the pending insertions
tasks before trying to move from the specified DSQ.

4. After ``ops.dispatch()`` returns, if there are tasks in the local DSQ,
the CPU runs the first one. If empty, the following steps are taken:

* Try to move from the global DSQ. If successful, run the task.

* If ``ops.dispatch()`` has dispatched any tasks, retry #3.

* If the previous task is an SCX task and still runnable, keep executing
it (see ``SCX_OPS_ENQ_LAST``).

* Go idle.

Note that the BPF scheduler can always choose to dispatch tasks immediately
in ``ops.enqueue()`` as illustrated in the above simple example. If only the
built-in DSQs are used, there is no need to implement ``ops.dispatch()`` as
a task is never queued on the BPF scheduler and both the local and global
DSQs are executed automatically.

``scx_bpf_dsq_insert()`` inserts the task on the FIFO of the target DSQ. Use
``scx_bpf_dsq_insert_vtime()`` for the priority queue. Internal DSQs such as
``SCX_DSQ_LOCAL`` and ``SCX_DSQ_GLOBAL`` do not support priority-queue
dispatching, and must be dispatched to with ``scx_bpf_dsq_insert()``. See
the function documentation and usage in ``tools/sched_ext/scx_simple.bpf.c``
for more information.

Where to Look
=============

* ``include/linux/sched/ext.h`` defines the core data structures, ops table
and constants.

* ``kernel/sched/ext.c`` contains sched_ext core implementation and helpers.
The functions prefixed with ``scx_bpf_`` can be called from the BPF
scheduler.

* ``tools/sched_ext/`` hosts example BPF scheduler implementations.

* ``scx_simple[.bpf].c``: Minimal global FIFO scheduler example using a
custom DSQ.

* ``scx_qmap[.bpf].c``: A multi-level FIFO scheduler supporting five
levels of priority implemented with ``BPF_MAP_TYPE_QUEUE``.

ABI Instability
===============

The APIs provided by sched_ext to BPF schedulers programs have no stability
guarantees. This includes the ops table callbacks and constants defined in
``include/linux/sched/ext.h``, as well as the ``scx_bpf_`` kfuncs defined in
``kernel/sched/ext.c``.

While we will attempt to provide a relatively stable API surface when
possible, they are subject to change without warning between kernel
versions.
13 changes: 13 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -19262,6 +19262,19 @@ F: include/linux/wait.h
F: include/uapi/linux/sched.h
F: kernel/sched/

SCHEDULER - SCHED_EXT
R: Tejun Heo <tj@kernel.org>
R: David Vernet <void@manifault.com>
L: linux-kernel@vger.kernel.org
S: Maintained
W: https://github.com/sched-ext/scx
T: git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git
F: include/linux/sched/ext.h
F: kernel/sched/ext.h
F: kernel/sched/ext.c
F: tools/sched_ext/
F: tools/testing/selftests/sched_ext

SCSI LIBSAS SUBSYSTEM
R: John Garry <john.g.garry@oracle.com>
R: Jason Yan <yanaijie@huawei.com>
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1392,6 +1392,11 @@ ifneq ($(wildcard $(objtool_O)),)
$(Q)$(MAKE) -sC $(abs_srctree)/tools/objtool O=$(objtool_O) srctree=$(abs_srctree) $(patsubst objtool_%,%,$@)
endif

# Clear a bunch of variables before executing the submake
ifeq ($(quiet),silent_)
tools_silent=s
endif

tools/: FORCE
$(Q)mkdir -p $(objtree)/tools
$(Q)$(MAKE) O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/
Expand Down
Loading
Loading