Does Lowlatency Kernal have Real-Time Preemption?

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

Post Reply
User avatar
milo
Established Member
Posts: 1242
Joined: Wed Sep 06, 2017 2:55 am
Location: Southern Utah, USA
Has thanked: 275 times
Been thanked: 218 times
Contact:

Does Lowlatency Kernal have Real-Time Preemption?

Post by milo »

I am tuning up a new Linux Mint 19.3 system for audio using the excellent script by @raboof (https://github.com/raboof/realtimeconfigquickscan). I have the lowlatency kernel installed and active:

Code: Select all

$user~$ uname -r
5.3.0-46-lowlatency
But the realtimeconfigquickscan output says that I don't have a kernel with real-time preemption.

Code: Select all

Kernel with Real-Time Preemption... not found - not good
Kernel without real-time capabilities found
For more information, see http://wiki.linuxaudio.org/wiki/system_configuration#installing_a_real-time_kernel
Forgive me if we've had this discussion before, but I thought the lowlatency kernel had real-time preemption. Am I missing something?
trulan
Established Member
Posts: 32
Joined: Tue Jul 13, 2010 12:55 am

Re: Does Lowlatency Kernal have Real-Time Preemption?

Post by trulan »

milo wrote: Fri Apr 10, 2020 2:19 pm Forgive me if we've had this discussion before, but I thought the lowlatency kernel had real-time preemption. Am I missing something?
The lowlatency kernel has some preemption, but not full real-time preemption. A lowlatency kernel with threaded irq's will perform almost as well as (and sometimes better than) an RT kernel. You will want to make sure to set the "threadirqs" boot parameter and install rtirq though. See https://wiki.linuxaudio.org/wiki/system ... the_kernel for some really good info on this.
User avatar
Bella
Established Member
Posts: 50
Joined: Thu Apr 02, 2020 10:46 pm
Location: PacNW
Has thanked: 7 times
Been thanked: 1 time

Re: Does Lowlatency Kernal have Real-Time Preemption?

Post by Bella »

I just ran into this same thing the other day on Mint 19.3 with low-latency kernel.
User avatar
milo
Established Member
Posts: 1242
Joined: Wed Sep 06, 2017 2:55 am
Location: Southern Utah, USA
Has thanked: 275 times
Been thanked: 218 times
Contact:

Re: Does Lowlatency Kernal have Real-Time Preemption?

Post by milo »

trulan wrote: Fri Apr 10, 2020 2:46 pm
milo wrote: Fri Apr 10, 2020 2:19 pm Forgive me if we've had this discussion before, but I thought the lowlatency kernel had real-time preemption. Am I missing something?
The lowlatency kernel has some preemption, but not full real-time preemption. A lowlatency kernel with threaded irq's will perform almost as well as (and sometimes better than) an RT kernel. You will want to make sure to set the "threadirqs" boot parameter and install rtirq though. See https://wiki.linuxaudio.org/wiki/system ... the_kernel for some really good info on this.
Thank you, that is helpful.
User avatar
raboof
Established Member
Posts: 1855
Joined: Tue Apr 08, 2008 11:58 am
Location: Deventer, NL
Has thanked: 50 times
Been thanked: 74 times
Contact:

Re: Does Lowlatency Kernal have Real-Time Preemption?

Post by raboof »

milo wrote: Fri Apr 10, 2020 2:19 pm the excellent script by @raboof (https://github.com/raboof/realtimeconfigquickscan)
Thanks!
milo wrote: Fri Apr 10, 2020 2:19 pm the realtimeconfigquickscan output says that I don't have a kernel with real-time preemption.

Code: Select all

Kernel with Real-Time Preemption... not found - not good
Kernel without real-time capabilities found
For more information, see http://wiki.linuxaudio.org/wiki/system_configuration#installing_a_real-time_kernel
Forgive me if we've had this discussion before, but I thought the lowlatency kernel had real-time preemption. Am I missing something?
Could you try updating to the latest version? Matthew Armand recently contributed an improvement to the script that will also consider a non-realtime but lowlatency kernel with thread_irq's enabled as 'good' - https://github.com/raboof/realtimeconfi ... 7c8fd86R57 - which was merged April 6th.
User avatar
milo
Established Member
Posts: 1242
Joined: Wed Sep 06, 2017 2:55 am
Location: Southern Utah, USA
Has thanked: 275 times
Been thanked: 218 times
Contact:

Re: Does Lowlatency Kernal have Real-Time Preemption?

Post by milo »

I just cloned the new version of the script from github. Not sure if it is working correctly. I am running a lowlatency kernel:

Code: Select all

$ uname -a
Linux inspiron 5.3.0-46-lowlatency #38~18.04.1-Ubuntu SMP PREEMPT Tue Mar 31 04:59:24 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
The script output says the kernel does not have real-time preemption, which makes sense to me now:

Code: Select all

Kernel with Real-Time Preemption... not found - not good
Kernel without 'threadirqs' parameter or real-time capabilities found
For more information, see https://wiki.linuxaudio.org/wiki/system_configuration#do_i_really_need_a_real-time_kernel
So I followed the link back to linuxaudio.org again to check if my kernel has thread_irq enabled:

Code: Select all

$ grep -e "CONFIG_IRQ_FORCED_THREADING=y" -e "CONFIG_PREEMPT=y" /boot/config-`uname -r`
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_PREEMPT=y
I think this means that thread_irq is enabled, right?
User avatar
sysrqer
Established Member
Posts: 2523
Joined: Thu Nov 14, 2013 11:47 pm
Has thanked: 320 times
Been thanked: 151 times
Contact:

Re: Does Lowlatency Kernal have Real-Time Preemption?

Post by sysrqer »

I also pulled from the latest master and got the same results running the liqourix kernel, seems like the new code isn't working?
trulan
Established Member
Posts: 32
Joined: Tue Jul 13, 2010 12:55 am

Re: Does Lowlatency Kernal have Real-Time Preemption?

Post by trulan »

milo wrote: Sat Apr 11, 2020 5:17 pm I think this means that thread_irq is enabled, right?
It means your kernel supports threaded irq's. It doesn't necessarily mean they are enabled; you still need to pass the 'threadirqs' flag to the kernel at boot time. You'll also want to make sure rtirq is installed so the priorities actually get set.

To check if it's working, run this command:

Code: Select all

$ ps -eLo pid,cls,rtprio,pri,nice,cmd | grep -i irq
If it returns a screenfull of information, it's working.

On the 'family' desktop, where I don't care, irq threading is not enabled. This is what it looks like when it's NOT working:

Code: Select all

trulan@kitchen ~ $ ps -eLo pid,cls,rtprio,pri,nice,cmd | grep -i irq
      9  TS      -  19   0 [ksoftirqd/0]
     16  TS      -  19   0 [ksoftirqd/1]
 174949  TS      -  19   0 grep --color=auto -i irq
User avatar
milo
Established Member
Posts: 1242
Joined: Wed Sep 06, 2017 2:55 am
Location: Southern Utah, USA
Has thanked: 275 times
Been thanked: 218 times
Contact:

Re: Does Lowlatency Kernal have Real-Time Preemption?

Post by milo »

Here's what I get:

Code: Select all

$ ps -eLo pid,cls,rtprio,pri,nice,cmd | grep -i irq
    9  TS      -  19   0 [ksoftirqd/0]
   18  TS      -  19   0 [ksoftirqd/1]
  125  FF     50  90   - [irq/9-acpi]
  142  FF     50  90   - [irq/16-ehci_hcd]
  143  FF     50  90   - [irq/23-ehci_hcd]
  144  FF     50  90   - [irq/27-xhci_hcd]
  145  FF     50  90   - [irq/8-rtc0]
  229  FF     50  90   - [irq/28-rtsx_pci]
  231  FF     50  90   - [irq/19-mmc0]
  232  FF     49  89   - [irq/19-s-mmc0]
  234  FF     50  90   - [irq/29-ahci[000]
  246  FF     50  90   - [irq/30-i915]
  467  FF     50  90   - [irq/31-mei_me]
  471  FF     50  90   - [irq/5-fintek-ci]
  576  FF     50  90   - [irq/16-ath9k]
  616  FF     50  90   - [irq/32-snd_hda_]
  809  TS      -  19   0 /usr/sbin/irqbalance --foreground
  809  TS      -  19   0 /usr/sbin/irqbalance --foreground
  941  FF     50  90   - [irq/33-enp3s0]
  942  FF     50  90   - [irq/34-enp3s0-T]
  943  FF     50  90   - [irq/35-enp3s0-t]
 2199  TS      -  19   0 grep --color=auto -i irq
I assume that means the kernel is getting the right flag at boot time.
User avatar
Bella
Established Member
Posts: 50
Joined: Thu Apr 02, 2020 10:46 pm
Location: PacNW
Has thanked: 7 times
Been thanked: 1 time

Re: Does Lowlatency Kernal have Real-Time Preemption?

Post by Bella »

I'm running kernel 4.15.0-96-lowlatency and using the updated version of realTimConfigQuickScan, and I, too, am still getting the following result:

Code: Select all

Kernel with Real-Time Preemption... not found - not good
Kernel without 'threadirqs' parameter or real-time capabilities found
For more information, see https://wiki.linuxaudio.org/wiki/system_configuration#do_i_really_need_a_real-time_kernel

When I check if it's working, I get:

Code: Select all

$ ps -eLo pid,cls,rtprio,pri,nice,cmd | grep -i irq
    7  TS      -  19   0 [ksoftirqd/0]
   17  TS      -  19   0 [ksoftirqd/1]
   23  TS      -  19   0 [ksoftirqd/2]
   29  TS      -  19   0 [ksoftirqd/3]
   47  FF     50  90   - [irq/9-acpi]
  101  FF     50  90   - [irq/24-PCIe PME]
  102  FF     50  90   - [irq/25-PCIe PME]
  103  FF     50  90   - [irq/26-PCIe PME]
  106  FF     50  90   - [irq/17-ehci_hcd]
  107  FF     50  90   - [irq/17-ehci_hcd]
  108  FF     50  90   - [irq/18-ohci_hcd]
  109  FF     50  90   - [irq/18-ohci_hcd]
  110  FF     50  90   - [irq/18-ohci_hcd]
  111  FF     50  90   - [irq/27-xhci_hcd]
  112  FF     50  90   - [irq/28-xhci_hcd]
  113  FF     50  90   - [irq/29-xhci_hcd]
  114  FF     50  90   - [irq/30-xhci_hcd]
  115  FF     50  90   - [irq/31-xhci_hcd]
  116  FF     50  90   - [irq/32-xhci_hcd]
  117  FF     50  90   - [irq/33-xhci_hcd]
  118  FF     50  90   - [irq/34-xhci_hcd]
  119  FF     50  90   - [irq/35-xhci_hcd]
  120  FF     50  90   - [irq/36-xhci_hcd]
  122  FF     50  90   - [irq/1-i8042]
  124  FF     50  90   - [irq/8-rtc0]
  207  FF     50  90   - [irq/38-ahci[000]
  227  FF     50  90   - [irq/41-radeon]
  592  FF     50  90   - [irq/42-iwlwifi]
  593  FF     49  89   - [irq/42-s-iwlwif]
  679  FF     50  90   - [irq/44-snd_hda_]
  681  FF     50  90   - [irq/16-snd_hda_]
  898  TS      -  19   0 /usr/sbin/irqbalance --foreground
  898  TS      -  19   0 /usr/sbin/irqbalance --foreground
 1067  FF     50  90   - [irq/39-eno1]
 3153  TS      -  19   0 grep --color=auto -i irq
And:

Code: Select all

$ grep -e "CONFIG_IRQ_FORCED_THREADING=y" -e "CONFIG_PREEMPT=y" /boot/config-`uname -r`
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_PREEMPT=y
trulan
Established Member
Posts: 32
Joined: Tue Jul 13, 2010 12:55 am

Re: Does Lowlatency Kernal have Real-Time Preemption?

Post by trulan »

milo wrote: Mon Apr 13, 2020 2:09 am I assume that means the kernel is getting the right flag at boot time.
Yep, that's what you're looking for. Now you just need to install the rtirq-init package so rtprio for audio related stuff gets set to something other than 50. :D I know it's mentally draining to see a script say "not good" about your system, but your kernel looks like it's good to go.
Post Reply