
Linux OS Optimization for DAW Performance
Posted on July 1, 2025
In this post i am going to talk about some of the things that you do if you are running a DAW on Linux and wish to get the best performance out it.
Firstly I personally think that Linux is be far the best operating system out there. It can be highly customised and you have complete choice over what runs on it. When i say this i am talking way beyond the applications that run on it. I am talking about the actual OS itself. Really Linux is just a kernel and you can choose to compile that kernel yourself and be very specific about what you functions and features you allow on it.
Linux OS Optimization for DAW Performance: The Foundation
When you're serious about audio production on Linux, the operating system itself becomes your first instrument. Unlike Windows or macOS, Linux gives you complete control over every aspect of system behavior—but with that power comes the responsibility to configure it correctly.
In this post, I'll walk you through the essential OS-level optimizations that transform a standard Linux installation into a professional audio workstation. These aren't just theoretical tweaks—they're battle-tested configurations that can mean the difference between seamless recording sessions and frustrating audio dropouts. The aim here really is to get your latency down as low as possible without any type of clicks or pops ( audio dropouts )
Why Standard Linux Isn't Ready for Audio
Out of the box, most Linux distributions are optimized for general computing tasks, not real-time audio processing. Here's what happens when you try to run a DAW on an unoptimized system:
-
Audio dropouts (XRUNs) when the system can't deliver audio buffers on time
-
High latency that makes real-time monitoring impossible
-
CPU scheduling conflicts between audio processes and system tasks
-
Memory allocation delays that interrupt audio streams
-
Power management features that throttle performance unpredictably
The solution? Transform your Linux kernel and system configuration for deterministic, real-time performance.
Step 1: Real-Time Kernel Configuration
Understanding Kernel Preemption
Standard Linux kernels use voluntary preemption—processes yield control when convenient. For audio, we need forced preemption where the kernel can interrupt any task to prioritize real-time audio processing.
Option A: Install a Pre-Built Low-Latency Kernel
Ubuntu/Debian:
# Install low-latency kernel
sudo apt update
sudo apt install linux-lowlatency linux-headers-lowlatency
# Verify installation
uname -r
# Should show something like: 5.15.0-56-lowlatency
Fedora:
# Install real-time kernel
sudo dnf install kernel-rt kernel-rt-devel
# Configure GRUB to boot RT kernel by default
sudo grubby --set-default-kernel=/boot/vmlinuz-$(uname -r | sed 's/\.x86_64$//')-rt
Option B: Compile a Full RT Kernel (Advanced)
For maximum control, compile the PREEMPT_RT patched kernel:
# Download kernel source and RT patches
wget https://www.kernel.org/pub/linux/kernel/v6.x/linux-6.1.tar.xz
wget https://www.kernel.org/pub/linux/kernel/projects/rt/6.1/patch-6.1-rt7.patch.xz
# Extract and apply RT patch
tar xf linux-6.1.tar.xz
cd linux-6.1
xzcat ../patch-6.1-rt7.patch.xz | patch -p1
# Configure for real-time
make menuconfig
# Enable: Processor type and features -> Preemption Model -> Fully Preemptible Kernel (RT)
# Compile and install
make -j$(nproc)
sudo make modules_install install
Verify Real-Time Capabilities
# Check kernel preemption model
cat /sys/kernel/debug/sched_features
grep -i preempt /boot/config-$(uname -r)
# Test real-time scheduling availability
sudo apt install rt-tests
sudo cyclictest -t1 -p 80 -i 10000 -l 100000
Step 2: Audio User Permissions and Limits
Add User to Audio Groups
# Add user to audio group
sudo usermod -a -G audio $USER
# For some distributions, also add to realtime group
sudo usermod -a -G realtime $USER
# Verify group membership
groups $USER
Configure Real-Time Limits
Edit /etc/security/limits.conf to allow audio processes real-time priority:
# Audio production limits
@audio - rtprio 95
@audio - nice -19
@audio - memlock unlimited
# If using realtime group instead
@realtime - rtprio 95
@realtime - nice -19
@realtime - memlock unlimited
What these settings mean:
-
rtprio 95: Allows real-time priority up to 95 (1-99 scale) -
nice -19: Permits highest CPU scheduling priority -
memlock unlimited: Prevents audio buffers from being swapped to disk
Verify Limit Application
# Check current limits (after reboot/re-login)
ulimit -r # Should show 95
ulimit -l # Should show unlimited
# Test real-time priority settings
sudo apt install util-linux
chrt -f 50 echo "RT priority test successful"
Step 3: CPU Governor Optimization
Understanding CPU Governors
CPU governors control processor frequency scaling. For audio work, we need consistent, maximum performance:
-
performance: Maintains maximum CPU frequency -
powersave: Reduces frequency for power efficiency (bad for audio) -
ondemand: Scales frequency based on load (can cause audio glitches)
Set Performance Governor
# Check current governor
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
# Set all CPUs to performance mode
echo 'performance' | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# Verify setting
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
Make Governor Setting Persistent
Method 1: systemd service
# Create service file
sudo tee /etc/systemd/system/cpu-performance.service << EOF
[Unit]
Description=Set CPU governor to performance
DefaultDependencies=false
After=sysinit.target local-fs.target
Before=basic.target
[Service]
Type=oneshot
ExecStart=/bin/bash -c 'echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor'
TimeoutSec=0
RemainAfterExit=yes
[Install]
WantedBy=basic.target
EOF
# Enable service
sudo systemctl enable cpu-performance.service
sudo systemctl start cpu-performance.service
Method 2: cpufrequtils
# Install cpufrequtils
sudo apt install cpufrequtils
# Configure in /etc/default/cpufrequtils
echo 'GOVERNOR="performance"' | sudo tee /etc/default/cpufrequtils
Advanced CPU Configuration
For even more control, disable CPU power management features:
# Edit GRUB configuration
sudo nano /etc/default/grub
# Add to GRUB_CMDLINE_LINUX:
GRUB_CMDLINE_LINUX="processor.max_cstate=1 intel_idle.max_cstate=0 idle=poll"
# Update GRUB
sudo update-grub
Step 4: Memory Management Optimization
Reduce Swappiness
Swappiness determines how aggressively the kernel swaps memory to disk. For real-time audio, minimize swapping:
# Check current swappiness
cat /proc/sys/vm/swappiness
# Set low swappiness temporarily
sudo sysctl vm.swappiness=1
# Make permanent
echo 'vm.swappiness=1' | sudo tee -a /etc/sysctl.conf
Disable Transparent Huge Pages
Transparent Huge Pages can cause memory allocation delays:
# Check current status
cat /sys/kernel/mm/transparent_hugepage/enabled
# Disable temporarily
echo never | sudo tee /sys/kernel/mm/transparent_hugepage/enabled
echo never | sudo tee /sys/kernel/mm/transparent_hugepage/defrag
# Make permanent via GRUB
sudo nano /etc/default/grub
# Add to GRUB_CMDLINE_LINUX: transparent_hugepage=never
sudo update-grub
Optimize Memory Zone Reclaim
# Disable zone reclaim mode
echo 0 | sudo tee /proc/sys/vm/zone_reclaim_mode
# Make permanent
echo 'vm.zone_reclaim_mode=0' | sudo tee -a /etc/sysctl.conf
Configure Memory Locking
For critical audio applications, lock memory pages:
# Check memory lock limits
ulimit -l
# Set memory lock in limits.conf (already covered above)
# @audio - memlock unlimited
# Verify large memory allocation capability
sudo apt install stress-ng
stress-ng --vm 1 --vm-bytes 1G --vm-keep --timeout 10s
Step 5: Additional System Optimizations
Disable CPU Mitigations (Optional)
CPU security mitigations can impact real-time performance. Only disable if you understand the security implications:
# Add to GRUB_CMDLINE_LINUX in /etc/default/grub
GRUB_CMDLINE_LINUX="mitigations=off"
# Update GRUB
sudo update-grub
Configure Timer Frequency
Higher timer frequency improves real-time responsiveness:
# Check current timer frequency
cat /boot/config-$(uname -r) | grep CONFIG_HZ
# During kernel compilation, set CONFIG_HZ=1000
# Or use a pre-compiled low-latency kernel with high timer frequency
Disable Unnecessary Services
# List running services
systemctl list-unit-files --type=service --state=enabled
# Disable unnecessary services (example)
sudo systemctl disable bluetooth
sudo systemctl disable cups
sudo systemctl disable avahi-daemon
# Keep essential services for audio
# Don't disable: NetworkManager, pulseaudio (if using), systemd services
Performance Verification and Testing
Install Testing Tools
sudo apt install rt-tests htop iotop cyclictest
Test Real-Time Performance
# Real-time latency test (run for several minutes)
sudo cyclictest -t 4 -p 80 -i 10000 -l 100000
# Expected results:
# - Max latency under 100 microseconds for good RT performance
# - Max latency under 50 microseconds for excellent performance
Monitor System Performance
# CPU usage and real-time processes
htop
# Press F5 to show process tree, look for RT priority processes
# Memory usage
free -h
# Check for memory swapping
vmstat 1 10
# si/so columns should remain at 0
# IRQ distribution
cat /proc/interrupts
watch -n 1 'cat /proc/interrupts'
Create Performance Testing Script
#!/bin/bash
# performance_test.sh
echo "=== Linux Audio Performance Check ==="
echo "Kernel version:"
uname -r
echo -e "\nPreemption model:"
grep -i preempt /boot/config-$(uname -r)
echo -e "\nCPU governor:"
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor | sort -u
echo -e "\nSwappiness:"
cat /proc/sys/vm/swappiness
echo -e "\nTransparent Huge Pages:"
cat /sys/kernel/mm/transparent_hugepage/enabled
echo -e "\nAudio group membership:"
groups $USER | grep audio
echo -e "\nRT priority limits:"
ulimit -r
echo -e "\nMemory lock limits:"
ulimit -l
echo -e "\nRunning real-time latency test..."
sudo cyclictest -t1 -p80 -i10000 -l10000 -q
Troubleshooting Common Issues
Problem: Still Getting Audio Dropouts
Solutions:
-
Increase JACK buffer size temporarily to isolate the issue
-
Check if other processes are competing for CPU
-
Verify RT kernel is actually running:
uname -r -
Ensure audio user limits are applied:
ulimit -rshould show 95
Problem: System Feels Sluggish
Solutions:
-
CPU governor set to performance can increase heat/power consumption
-
Consider using
schedutilgovernor as compromise -
Check if CPU thermal throttling is occurring:
sensors
Problem: Browser/Other Apps Becoming Unresponsive
Solutions:
-
This is expected with aggressive RT optimization
-
Use
niceto lower priority of non-audio applications:nice -n 19 firefox -
Consider CPU isolation (covered in advanced tutorials)
Next Steps
You now have a solid foundation for Linux audio production. Your system should be capable of:
-
Sub-10ms audio latency with proper audio interface
-
Zero XRUNs during normal recording sessions
-
Consistent performance without dropouts
Coming up in our next post: Configuring Linux audio servers (JACK, ALSA, PipeWire) and choosing the right setup for your workflow.
Quick Verification Checklist
Before moving on, verify:
-
RT or low-latency kernel installed and running
-
User in audio group with proper limits
-
CPU governor set to performance
-
Memory settings optimized (swappiness, THP disabled)
-
Real-time latency test shows <100μs max latency
Your Linux system is now ready for professional audio production. The foundation is solid—now we can build the audio infrastructure on top of it.