Preempt_none Is Dead; Your Postgres Probably Doesn't Care
4 days ago
- #Linux Kernel
- #PostgreSQL
- #Performance Tuning
- AWS benchmark showed PostgreSQL throughput dropping to 0.51x on Linux 7.0 vs 6.x due to a regression from removing PREEMPT_NONE preemption mode.
- The performance issue is caused by minor page faults inside a spinlock (buffer_strategy_lock) when using 4KB pages with large shared memory (100+ GB), exacerbated by PREEMPT_LAZY.
- Enabling huge pages (huge_pages=on) eliminates the regression by reducing page faults and TLB pressure, making the kernel upgrade safe for most users.
- Self-hosted servers should configure huge pages properly; containerized setups need host-level huge page reservations or reduced shared_buffers.
- Cloud database users rely on vendors to handle kernel and huge page configurations, with no action required on their part.
- The kernel community suggested using rseq for scheduler hints, but this is not a practical immediate fix; PostgreSQL may adopt it in future versions.
- The benchmark artifact highlights the importance of correct configuration (huge pages) for large shared memory workloads, not a fundamental Linux issue.