# WolKernel

> WolKernel is Linux with small, switchable patches for the app in front: who runs first, what wakes the processor, and what goes when memory runs out.

Source: https://wolos.org/kernel

Linux 7.3 with 20 small patches (each under 100 lines, each with an off switch) and the scx_wolos scheduler, which sorts threads into five classes so the app in front runs first. Source: https://github.com/wonderlandos/linux (tags wolkernel-1.0-7.3).

| Patch | Area | What | Upstream |
|---|---|---|---|
| 0004-futex-adaptive-spin | sync | 0001's spin only when the CPU has nothing else runnable, budget scaled by a per-bucket score (wakeup +1, timeout /2) | none upstream |
| 0005-wolos-policy-kunit | test | <linux/wolos_policy.h>: the decisions below as pure functions | WolOS-only |
| 0006-tsc-trust-single-package | time | no clocksource watchdog on one-package bare metal with an invariant TSC, even without TSC_ADJUST (AMD desktops); tsc=watchdog restores it | idea discussed upstream, not merged |
| 0007-vt-kbd-graphics-bypass | input | kbd_event returns early in K_OFF + KD_GRAPHICS (compositor session): no keymap, LED tasklet or console work per key; key_down kept | none upstream |
| 0008-oom-foreground-bias | memory | OOM badness: foreground tgid /4, SCHED_IDLE + RAM/8; oom_score_adj on top | none upstream |
| 0009-input-boost | input/cpufreq | input handler on key/button devices opens a wolos_input_boost.ms (100 ms) window, rate-limited 50 ms; schedutil floors CPUs at floor_pct (60%); wolos_input_boost_chain for GPU drivers | none upstream |
| 0010-pipe-wake-check | ipc | skip the wait-queue lock when nobody sleeps; pipe.wake_check=0; single-thread write+read 4% faster | none upstream |
| 0011-sem-one-lock-read | ipc | GETVAL, GETPID, GETNCNT, GETZCNT take one semaphore's lock; sem.read_one_lock=0; semops next to a reader 13x | none upstream |
| 0012-slub-sheaf-scale | memory | sheaf capacity x slub_sheaf_scale (1..4, default 2; 1 = stock); hackbench socket +4% vs scale 1 on one binary, not shown against base | none upstream |
| 0013-ntsync-inline-wait | sync | waits on up to 4 entries use a cache-aligned on-stack queue; ntsync.inline_wait=0; signaled waits 4.5% faster, blocking ping-pong 5% slower before the alignment, aligned version not measured | none upstream |
| 0014-futex-spin-rcu | sync | 0004's spin holds RCU across the bucket access | fix to 0004 |
| 0015-futex-waitv-inline | sync | futex_waitv on up to 4 futexes uses an on-stack vector; futex.waitv_inline=0 | none upstream |
| 0016-futex-precheck | sync | FUTEX_WAIT and futex_waitv read the word first; futex.precheck=0 | none upstream |
| 0017-futex-waitv-spin | sync | adaptive spin for futex_waitv; futex.waitv_spin=0; waitv ping-pong 3350 to about 285 ns | none upstream |
| 0018-futex-waitv-scan | sync | futex_waitv answers a mismatch in one user access window; any odd entry or fault takes the full path, so an invalid address after a mismatch, or an unreadable one before it, keeps its -EINVAL/-EFAULT (fixes 0016); futex.precheck=0 | fix to 0016 |
| 0030-wolos-bend | lib | lib/wolos_bend: CAS link/subst, Chase-Lev deques with batched stealing, worker arenas, generation-checked index pools, fork/join on idle CPUs | WolOS-only |
| 0031-clear-large-folios-parallel | memory | folios of 4 MiB and up clear on idle CPUs: 1 GiB first touch 91.7 to 24.1 ms idle, no gain with every CPU busy, 2 MiB THP unchanged; smaller folios pay one compare | none upstream |
| 0032-syscall-exit-status-store | entry | no write to thread_info.status on 64-bit syscall exit unless a bit is set: perf c2c shows no more HITMs on the first task_struct line (976 of 14741 in perf bench epoll wait); throughput unchanged within noise | candidate |
| 0033-enosys-under-ptrace | entry | out-of-range syscalls return -ENOSYS after a tracer wrote ax; syscall_numbering_64 passes without x32 | candidate |
| 0034-wolos-bend-reclaim | lib | bend_fork_join is safe from reclaim: rescuer on the queue, GFP_NOWAIT per-run state | WolOS-only |
