Pinning Isn't Enough: Gang-Scheduling Memory-Model Litmus Tests with sched_ext
Abstract
Litmus tests are the empirical workhorse for characterizing hardware memory models: small concurrent programs whose “weak” outcomes reveal how a processor reorders memory accesses. Their effectiveness hinges on a property the test cannot control on its own: its threads must execute simultaneously on different cores, within a window of a few cycles. On a multi-socket NUMA machine, the default Linux scheduler may scatter those threads across sockets, collapsing the observed weak-behavior rate by roughly 8× relative to careful same-socket placement. Manual pinning recovers sensitivity for a single hand-tuned test, but affinity alone does not coordinate complete tests once a campaign oversubscribes the available CPUs. We use sched_ext, the Linux extensible-scheduler interface, to make placement explicit. A spatial gang scheduler reserves dedicated, NUMA-local cores for each test, automatically matching hand-tuned pinning and turning a wildly bimodal rate into a high and predictable one. A temporal gang scheduler time-slices whole tests as units, sustaining high per-test rates even at 2× oversubscription, which neither SCHED_FIFO nor static affinity can express. The result is both a practical improvement to memory-model testing and a case study in encoding a workload's correctness invariant (“these threads must run together”) directly in an eBPF scheduling policy.