How to Turn Off KPTI to Improve Performance in Fedora

9,564

Fedora has KPTI since 4.14.11 - https://fedoramagazine.org/protect-fedora-system-meltdown/

New kernel packages contain fixes for Fedora 26 and 27 (kernel version 4.14.11),

The nopti is kernel cmdline boot option - https://access.redhat.com/articles/3311301

Persistently disable - Effective across a reboot kernel command line by adding these flags, then reboot the kernel to have them take effect:

Edit it in your bootloader (GRUB) settings: https://fedoraproject.org/wiki/GRUB_2 (with files in /etc/default/grub and /etc/grub.d/)

GRUB_CMDLINE_LINUX=' .... nopti'

Then apply changes by regenerating of real grub config file

for BIOS systems:

 grub2-mkconfig -o /boot/grub2/grub.cfg  

for UEFI-based systems:

 grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg  

Then do reboot and check cat /proc/cmdline|grep pti and cat /sys/kernel/debug/x86/pti_enabled.

RHEL https://access.redhat.com/articles/3311301 also lists command echo 0 > /sys/kernel/debug/x86/pti_enabled to turn off PTI, this may work only for processes started after changing the setting.

Share:
9,564
Mehdi Haghgoo
Author by

Mehdi Haghgoo

Twitter: @IAmMehdiHaghgoo

Updated on September 18, 2022

Comments

  • Mehdi Haghgoo
    Mehdi Haghgoo over 1 year

    Following the outbreak of KPTI news, I recently updated my kernel to 4.14.11-300. In addition to a quite sufficient RAM (8 GB) and fast IO (SSD disk), I have started to feel remarkable slowdown in my system performance when I am mulitasking for example editing code and perform some other not-so-resource-intensive jobs, especially when I run out of physical RAM and switch to swap, which is hosted on SSD disk. I read in article, that you can disable the new imposed performance hit using the nopti option. I did not find any command on my Fedora 26 as nopti. Where should I use this feature and how?

    • mattdm
      mattdm over 6 years
      I don't think you should see "remarkable slowdown" when you are doing tasks like editing code. I'd investigate to make sure something else isn't causing issues and the KPTI patch just a coincidence.
    • Mikko Rantalainen
      Mikko Rantalainen over 5 years
      I would bet that your "remarkable slowdown" is caused solely by running out of RAM. Try to kill some processes to increase the amount of "MemAvailable" RAM in /proc/meminfo and you should see improved performance. Note that the "MemAvailable" includes all caches and buffers so if you're running low, the system has to deal with lower cache and buffer sizes and the performance will suffer.
  • Mehdi Haghgoo
    Mehdi Haghgoo over 6 years
    Added nopti to GRUB_CMDLINE_LINUX in /det/default/grub, but when I check at boot time, it is not applied!
  • osgx
    osgx over 6 years
    Do refresh of your real GRUB config from /etc files with grub2-mkconfig -o /boot/grub2/grub.cfg for BIOS and `grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg for UEFI-based grub as said in fedoraproject.org/wiki/GRUB_2