Back to Home

Linux 7.0 regression PostgreSQL ARM64

In Linux 7.0, scheduler regression halves PostgreSQL performance on ARM64 due to PREEMPT_LAZY and increased time in s_lock(). Amazon suggests rollback, Zijlstra — rseq in userspace. Solution expected before release.

PostgreSQL twofold drop on Linux 7.0: s_lock issue
Advertisement 728x90

# Regression in Linux 7.0 Doubles Time Spent on s_lock() in PostgreSQL on ARM64

Amazon developer Salvatore DiPietro discovered a performance drop on ARM64 systems while testing PostgreSQL on the pre-release version of Linux kernel 7.0. The pgbench test in the simple-update scenario showed TPS dropping from 98,565 to 50,751—nearly half. The issue stems from a change in the task scheduler's preemption mode: the default switched from PREEMPT_NONE to PREEMPT_LAZY for supported architectures.

This change caused PostgreSQL in user space to spend 55% of CPU time on s_lock() calls. Kernel 7.0 is slated for Ubuntu 26.04 LTS, with release expected in mid-April 2026.

Regression Details and Analysis

The change in the scheduler, made by Peter Zijlstra, activated PREEMPT_LAZY, tied to ARCH_NO_PREEMPT. On ARM64, this ramps up task preemption, which is critical for high-load DBMS like PostgreSQL.

Google AdInline article slot

Profiling showed:

  • Time in s_lock() ballooned to 55% of total CPU.
  • Reduced throughput and responsiveness under pgbench load.
  • Impacts only architectures supporting LAZY mode.

Experts note that the final testing stage for kernel 7.0 limits the option to revert without risking new regressions.

Proposed Fixes

DiPietro proposes reverting to PREEMPT_NONE by default and decoupling it from ARCH_NO_PREEMPT. Zijlstra, the patch author and scheduler subsystem maintainer, insists on improving PostgreSQL:

Google AdInline article slot
  • Use the kernel's rseq slice (Restartable Sequences) extension to minimize preemption of lock holders.
  • Optimize spinlock handling in user-space code.

Rseq slice enables atomic checking and updating of sequence states, cutting the risk of interrupting critical sections.

Community Position and Linus's Decision

OpenNET experts highlight Linus Torvalds's principle: the kernel must not degrade performance or break user-space compatibility. The standoff between a kernel revert (release risk) and a PostgreSQL fix (requires DBMS tweaks) remains unresolved.

For mid/senior developers testing PostgreSQL on ARM64:

Google AdInline article slot
  • Benchmark pgbench performance on kernel 7.0-rc.
  • Monitor %CPU in s_lock() via perf.
  • Consider rseq for lock optimization in your projects.
  • Watch LKML for scheduler patches.

Key Points

  • Regression halves PostgreSQL TPS on ARM64 due to PREEMPT_LAZY.
  • Zijlstra recommends rseq slice in user space over kernel revert.
  • Torvalds to decide before Linux 7.0 release in April 2026.
  • Test rc versions: perf record -e cycles for s_lock() analysis.

— Editorial Team

Advertisement 728x90

Read Next