HeadlinesBriefing favicon HeadlinesBriefing.com

Restartable Sequences Boost Multi‑Core Performance

Hacker News •
×

The Linux kernel introduced restartable sequences (rseq) in version 4.18 back in 2018, offering a lock‑free path for thread‑local data structures. By exposing a 32‑byte TLS area that the kernel updates with the current CPU ID, rseq lets programs replace costly syscalls like sched_getcpu() with a single relaxed move. Early adopters such as tcmalloc, jemalloc, glibc and Cosmopolitan expose benefit. It also reduces cacheline contention.

Performance gaps widen on processors with dozens or hundreds of cores. On a $4,834 System76 Thelio Astro equipped with a 128‑core Ampere Altra, rseq accelerated Cosmopolitan malloc by 34x compared to a traditional sched_getcpu() sharding scheme. Similar tests on a $17,629 AMD Threadripper Pro 96‑core showed a 43× speedup, proving that lock‑based designs become a bottleneck at scale.

Because rseq currently requires hand‑written assembly, its adoption remains limited to low‑level libraries. The author predicts universal kernel support and language primitives will soon make restartable sequences a standard tool for high‑throughput servers and scientific workloads. Until those abstractions appear, developers with access to many‑core hardware can achieve order‑of‑magnitude gains by integrating rseq directly in production environments.