

apt install -y linux-image-rt-amd64


#Edit /etc/default/grub
# Add 'threadirqs' to kernel boot args.

#reboot computer and in the bios, disable hyperthreading

#Add yourself to the audio group.

usermod -aG audio user


# edit /etc/security/limits.d/99-realtime.conf
# make sure this is there (and not commented)
"""
@audio   -  rtprio     99
@audio   -  memlock    unlimited
@realtime   -  rtprio     99
@realtime   -  memlock    unlimited
"""

#Set the cpufreq governor to performance. << thats important, (also important to have good cooling of laptop, cause it will clock down anyway if it is too hot)

echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor

#Add noatime to all filesystems in  fstab.


#Additionaly, you may want to increase the highest requested RTC interrupt frequency (default is 64 Hz)

echo 2048 > /sys/class/rtc/rtc0/max_user_freq
echo 2048 > /proc/sys/dev/hpet/max-user-freq

# swap less often
echo 10 > /proc/sys/vm/swappiness

echo 524288 > /proc/sys/fs/inotify/max_user_watches

## we do not currently use pci souncard, but if we do:
#You may also want to maximize the PCI latency timer of the PCI sound card and raise the latency timer of all other PCI peripherals (default is 64).
#
#$ setpci -v -d *:* latency_timer=b0
#$ setpci -v -s $SOUND_CARD_PCI_ID latency_timer=ff # eg. SOUND_CARD_PCI_ID=03:00.0 (see below)


#http://subversion.ffado.org/wiki/IrqPriorities
#https://packages.debian.org/stretch/linux-image-rt-amd64
#Kernel settings, check if image-rt has them:
#Timer Frequency is set to 1000Hz (CONFIG_HZ_1000=y; if you do not do MIDI you can ignore this)
#APM is DISABLED (CONFIG_APM=n; Troublesome with some hardware - default in x86_64)
