Performance Regression in PostgreSQL Due to Linux 7.0 Kernel Changes
On Friday, an engineer from Amazon/AWS raised significant concerns regarding the performance of the PostgreSQL database server when running on the nearly finalized Linux 7.0 development kernel. The findings indicate that throughput has dropped to approximately half of what was achieved with previous kernel versions.
Salvatore Dipietro, the engineer in question, reported a notable regression in both throughput and latency for PostgreSQL when tested on a Graviton4 server. The analysis revealed that the Linux 7.0 kernel is causing the database to operate at around 0.51 times the throughput of its predecessors, primarily due to an increased amount of time spent in a user-space spinlock.
The root cause of this regression has been traced back to a modification in Linux 7.0 that restricts the available preemption modes for the kernel. This change was previously discussed in detail on Phoronix, highlighting the kernel’s focus on full and lazy preemption models tailored for modern CPU architectures. The updates were subsequently integrated into the Linux 7.0 scheduler.
In response to the identified performance issues, a patch was submitted to the Linux kernel mailing list to revert to PREEMPT_NONE as the default preemption model, given the severity of the regression. However, it appears that this proposed fix may not be adopted. Peter Zijlstra, the original author of the code that simplified the preemption modes, suggested that the solution lies in adapting PostgreSQL to utilize the Restartable Sequences (RSEQ) time slice extension, which has also been incorporated into Linux 7.0.
“The fix here is to make PostgreSQL make use of rseq slice extension. That should limit the exposure to lock holder preemption (unless PostgreSQL is doing seriously egregious things).”
If this approach is accepted, it could shift the responsibility for the performance drop onto PostgreSQL itself. Consequently, users may experience a significant decline in PostgreSQL performance under certain conditions until the database server is updated to accommodate these changes.
The stable release of Linux 7.0 is anticipated in approximately two weeks, coinciding with the upcoming launch of Ubuntu 26.04 LTS, which will also be powered by this kernel version.