custom_crash_light

Function custom_crash_light 

Source
pub fn custom_crash_light(ctx: &Ctx<'_>) -> Result<AssertResult>
Expand description

Light workload for scheduler-DEATH tests: one cgroup of 4 YieldHeavy workers held for the scenario duration.

Deliberately light — few continuously-runnable tasks — so that when the sched_ext scheduler dies mid-run, the kernel’s scheduler-disable (scx_ops_disable) bypass-drain has trivially few runnable tasks to migrate. Both death paths funnel through the same drain: an scx_bpf_error crash (host-injected via bpf_map_write, fires on any ktstr_dispatch call) AND a watchdog stall (--stall-after, which the kernel’s per-rq sched_ext watchdog fires: scx_watchdog_workfn’s delayed workqueue runs check_rq_for_timeouts (kernel/sched/ext.c), which calls scx_exit(..., SCX_EXIT_ERROR_STALL, ...) once a runnable task exceeds watchdog_timeout). The scheduler only stops dispatching under --stall-after (if (stall) return;); it runs no timer of its own. A heavy runnable workload (e.g. custom_sched_mixed’s 12 SpinWait tasks) triggers the Linux 6.14 per-node global-DSQ bypass-drain livelock, which strands the whole guest until the host watchdog fires; that livelock is fixed upstream only in sched_ext/for-7.1 (per-CPU bypass DSQs + an interruptible aborting consume loop), so ktstr cannot patch it and instead keeps the death-test workload light. The death still fires, and the death -> scx exit -> auto-repro -> wprof-capture path is exercised identically, so no coverage is lost.