📖 ~1 min read
Table of contents
Symptom & Impact
Transparent huge pages cause database latency spikes on CentOS Stream 9 disrupts services and slows incident response until the root cause is resolved.
Environment & Reproduction
PostgreSQL latency spikes correlate with THP defrag scans on Stream 10.
cat /sys/kernel/mm/transparent_hugepage/enabled
perf top
Root Cause Analysis
Misalignment between performance configuration and CentOS Stream 9 defaults causes the failure path described above.
Quick Triage
Confirm package state, service status, and recent changes before deeper diagnostics.
systemctl status
rpm -qa | grep -i
journalctl -p err -b --no-pager | tail -100
Step-by-Step Diagnosis
Capture detailed logs, configuration deltas, and runtime state to isolate the failing component.
perf record -g -a sleep 30
grep -i thp /proc/vmstat
cat /sys/kernel/mm/transparent_hugepage/defrag

Solution – Primary Fix
Apply the targeted configuration change and restart the relevant services to restore expected behavior.
Still having issues? Our Managed IT Services team can diagnose and resolve this for you. Get in touch for a free consultation.
echo madvise | sudo tee /sys/kernel/mm/transparent_hugepage/enabled
echo defer | sudo tee /sys/kernel/mm/transparent_hugepage/defrag
sudo grubby --args='transparent_hugepage=madvise' --update-kernel=ALL

Solution – Alternative Approaches
Disable THP entirely (never) only for workloads that explicitly need it.
Verification & Acceptance Criteria
Validate the fix with deterministic checks and ensure no regressions in dependent services.
cat /sys/kernel/mm/transparent_hugepage/enabled
pg_stat_statements latency
Rollback Plan
Revert configuration and restart services to return to the previous known-good state.
echo always | tee /sys/kernel/mm/transparent_hugepage/enabled
Prevention & Hardening
Bake THP setting into kernel cmdline and validate via Ansible.
Related Errors & Cross-Refs
Related: THP, khugepaged, defrag latency; see also adjacent topics in the CentOS Stream 9 common problems series.
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
CentOS Stream documentation, Red Hat upstream guides, and CentOS Stream 9 release notes covering this subsystem.
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.