📖 ~1 min read
Table of contents
Symptom & Impact
Postgres latency spikes on CS9
Environment & Reproduction
THP defragmentation pauses Postgres workers.
Root Cause Analysis
khugepaged compaction contends with database memory mapping.
Quick Triage
cat /sys/kernel/mm/transparent_hugepage/enabled and check perf top.
Step-by-Step Diagnosis
Run: grep -H . /sys/kernel/mm/transparent_hugepage/{enabled,defrag}.

Solution – Primary Fix
echo never > /sys/kernel/mm/transparent_hugepage/enabled and persist via tuned profile.
Still having issues? Our Managed IT Services team can diagnose and resolve this for you. Get in touch for a free consultation.

Solution – Alternative Approaches
Switch to madvise instead of never for mixed workloads.
Verification & Acceptance Criteria
p99 query latency returns to baseline and khugepaged CPU usage drops.
Rollback Plan
Re-enable THP via tuned-adm profile switch if regression occurs.
Prevention & Hardening
Apply throughput-performance tuned profile with custom THP override.
Related Errors & Cross-Refs
Pairs with stalled task warnings and high sys CPU.
Related tutorial: View the step-by-step tutorial for centos-stream-9.
View all centos-stream-9 tutorials on the Tutorials Hub →
Browse all common problems & solutions on the Tutorials Hub.
References & Further Reading
tuned(8) and PostgreSQL THP guidance.
Need Expert Help?
If you cannot resolve this yourself, our team offers hands-on Server Management, Managed IT Services, and flexible Support Plans. Contact us today — we respond within one business day.