Realtime priority?

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

Death
Established Member
Posts: 372
Joined: Sun Oct 11, 2015 1:43 pm
Been thanked: 32 times

Realtime priority?

Post by Death »

I'm using Cadence on Manjaro and I was looking in the Cadence settings and saw 'Realtime Priority' which had a value of 10. I tried raising it to 95 because I thought that was the number it's usually recommended to be at for audio stuff (?), but it made no difference as far as I could tell. I wasn't sure if I'd just screwed with my system config by doing that so I decided to restore my system with Timeshift, but the setting persisted. I found some Cadence config files in my Home folder and deleted them but it the setting persisted still. So, I went back into Cadence and changed the Realtime Priority setting back to 10.

So I guess my question is, what have I just messed with and what number should I set it to?

As a side note, in etc>security>limits.d there is a file named 99-realtime-privileges.conf which contains these lines

Code: Select all

@realtime - rtprio 98
@realtime - memlock unlimited
Maybe that's a clue to what I should set the Realtime Priority to? I don't quite know what I'm doing incase you couldn't tell haha..

I'd appreciate some help! Thanks :wink:
Death
Established Member
Posts: 372
Joined: Sun Oct 11, 2015 1:43 pm
Been thanked: 32 times

Re: Realtime priority?

Post by Death »

Someone must know..? :|
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: Realtime priority?

Post by lilith »

You cannot break you system by changing this value. A good value for the RT priority of Jack is 80. The soundcard can have a higher priority of 95.
You can set it to 80 and check with

Code: Select all

ps -eLo rtprio,cls,pid,pri,nice,cmd | grep "FF" | sort -r
if it works. You also can post the output here.
Death
Established Member
Posts: 372
Joined: Sun Oct 11, 2015 1:43 pm
Been thanked: 32 times

Re: Realtime priority?

Post by Death »

I wasn't worried about breaking the system so much. I just wanted to have the setting at the recommended value for good audio performance. But are you saying this value in Cadence is actually a priority setting just for Jack? If that's the case, I'm not sure what the soundcard priority is set to. I've also read that in some situations, a lower number equals a higher priority. It's all confusing..

Anyway, I ran the command without changing any settings.

Code: Select all

$ ps -eLo rtprio,cls,pid,pri,nice,cmd | grep "FF" | sort -r
     -  TS   21556  19   0 grep --colour=auto FF
    99  FF      96 139   - [migration/12]
    99  FF      89 139   - [migration/11]
    99  FF      82 139   - [migration/10]
    99  FF      75 139   - [migration/9]
    99  FF      68 139   - [migration/8]
    99  FF      61 139   - [migration/7]
    99  FF      54 139   - [migration/6]
    99  FF      47 139   - [migration/5]
    99  FF      40 139   - [migration/4]
    99  FF      33 139   - [migration/3]
    99  FF      26 139   - [migration/2]
    99  FF     235 139   - [watchdogd]
    99  FF      19 139   - [migration/1]
    99  FF      13 139   - [migration/0]
    99  FF     117 139   - [migration/15]
    99  FF     110 139   - [migration/14]
    99  FF     103 139   - [migration/13]
    50  FF      95  90   - [idle_inject/12]
    50  FF      88  90   - [idle_inject/11]
    50  FF      81  90   - [idle_inject/10]
    50  FF      74  90   - [idle_inject/9]
    50  FF      67  90   - [idle_inject/8]
    50  FF      60  90   - [idle_inject/7]
    50  FF      53  90   - [idle_inject/6]
    50  FF      46  90   - [idle_inject/5]
    50  FF      39  90   - [idle_inject/4]
    50  FF      32  90   - [idle_inject/3]
    50  FF      25  90   - [idle_inject/2]
    50  FF     245  90   - [irq/30-aerdrv]
    50  FF     244  90   - [irq/28-aerdrv]
    50  FF     243  90   - [irq/27-aerdrv]
    50  FF     242  90   - [irq/26-aerdrv]
    50  FF     236  90   - [irq/25-AMD-Vi]
    50  FF      18  90   - [idle_inject/1]
    50  FF      14  90   - [idle_inject/0]
    50  FF     116  90   - [idle_inject/15]
    50  FF     109  90   - [idle_inject/14]
    50  FF     102  90   - [idle_inject/13]
     1  FF      97  41   - [rcuc/12]
     1  FF      90  41   - [rcuc/11]
     1  FF      83  41   - [rcuc/10]
     1  FF     805  41   - [jpeg_dec]
     1  FF     804  41   - [vcn_enc1]
     1  FF     803  41   - [vcn_enc0]
     1  FF     802  41   - [vcn_dec]
     1  FF     801  41   - [sdma1]
     1  FF     800  41   - [sdma0]
     1  FF     799  41   - [comp_1.3.1]
     1  FF     798  41   - [comp_1.2.1]
     1  FF     797  41   - [comp_1.1.1]
     1  FF     796  41   - [comp_1.0.1]
     1  FF     795  41   - [comp_1.3.0]
     1  FF     794  41   - [comp_1.2.0]
     1  FF     793  41   - [comp_1.1.0]
     1  FF     792  41   - [comp_1.0.0]
     1  FF     791  41   - [gfx_0.0.0]
     1  FF      76  41   - [rcuc/9]
     1  FF      69  41   - [rcuc/8]
     1  FF      62  41   - [rcuc/7]
     1  FF      55  41   - [rcuc/6]
     1  FF      48  41   - [rcuc/5]
     1  FF      41  41   - [rcuc/4]
     1  FF      34  41   - [rcuc/3]
     1  FF      27  41   - [rcuc/2]
     1  FF      20  41   - [rcuc/1]
     1  FF      12  41   - [rcub/1]
     1  FF     118  41   - [rcuc/15]
     1  FF      11  41   - [rcu_preempt]
     1  FF     111  41   - [rcuc/14]
     1  FF     104  41   - [rcuc/13]
     1  FF      10  41   - [rcuc/0]
Does that give us any answers?

Cheers.
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: Realtime priority?

Post by lilith »

I'm not an expert. Maybe others can better answer your questions. The priority is just a number, yes. You have to interpret them relative to the highest priority which is 99 in case of RT system processes. Do you have any problems with xruns? I don't see your interface in the output that you posted.
In my case it looks like:

Code: Select all

ps -eLo rtprio,cls,pid,pri,nice,cmd | grep "FF" | sort -r
     -  TS  5111  19   0 grep FF
    99  FF    61 139   - [watchdogd]
    99  FF    38 139   - [posixcputmr/3]
    99  FF    37 139   - [migration/3]
    99  FF    30 139   - [posixcputmr/2]
    99  FF    29 139   - [migration/2]
    99  FF    22 139   - [posixcputmr/1]
    99  FF    21 139   - [migration/1]
    99  FF    17 139   - [migration/0]
    99  FF    16 139   - [posixcputmr/0]
    95  FF   181 135   - [irq/28-xhci_hcd]
    94  FF   206 134   - [irq/30-xhci_hcd]
    80  FF  2557 120   - /usr/bin/jackdbus auto
    75  FF  2559 115   - /usr/bin/a2jmidid dbus
    50  FF   763  90   - [irq/26-enp2s0]
     1  FF    40  41   - [ktimersoftd/3]
     1  FF    39  41   - [rcuc/3]
...
where xhci_hcd is the interface, so it gets the highest priority allowed in (@realtime - rtprio 95). The value 80 for Jack comes from the Jack setting.
If you install rtirq from you repository the priorities are handled automatically https://alsa.opensrc.org/Rtirq.

When rtirq is running you can stop it with

Code: Select all

sudo /etc/init.d/rtirq stop
and restart it with

Code: Select all

sudo /etc/init.d/rtirq restart
to check if the ps command gives any difference. In order to make rtirq work you have to set the threadirqs kernel option. How this is done is described
@ https://wiki.linuxaudio.org/wiki/system_configuration
Open /etc/default/grub with your favorite editor as root. Look for the line that starts with GRUB_CMDLINE_LINUX_DEFAULT and add threadirqs to the list of options:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash threadirqs"
Save the file and update the grub configuration:
sudo update-grub
But before doing anything you may first tell us if you have any issues or what you are aiming for.
Death wrote: Fri Apr 17, 2020 9:02 pm I wasn't worried about breaking the system so much. I just wanted to have the setting at the recommended value for good audio performance. But are you saying this value in Cadence is actually a priority setting just for Jack? If that's the case, I'm not sure what the soundcard priority is set to. I've also read that in some situations, a lower number equals a higher priority. It's all confusing..

Anyway, I ran the command without changing any settings.

Code: Select all

$ ps -eLo rtprio,cls,pid,pri,nice,cmd | grep "FF" | sort -r
     -  TS   21556  19   0 grep --colour=auto FF
    99  FF      96 139   - [migration/12]
    99  FF      89 139   - [migration/11]
    99  FF      82 139   - [migration/10]
    99  FF      75 139   - [migration/9]
    99  FF      68 139   - [migration/8]
    99  FF      61 139   - [migration/7]
    99  FF      54 139   - [migration/6]
    99  FF      47 139   - [migration/5]
    99  FF      40 139   - [migration/4]
    99  FF      33 139   - [migration/3]
    99  FF      26 139   - [migration/2]
    99  FF     235 139   - [watchdogd]
    99  FF      19 139   - [migration/1]
    99  FF      13 139   - [migration/0]
    99  FF     117 139   - [migration/15]
    99  FF     110 139   - [migration/14]
    99  FF     103 139   - [migration/13]
    50  FF      95  90   - [idle_inject/12]
    50  FF      88  90   - [idle_inject/11]
    50  FF      81  90   - [idle_inject/10]
    50  FF      74  90   - [idle_inject/9]
    50  FF      67  90   - [idle_inject/8]
    50  FF      60  90   - [idle_inject/7]
    50  FF      53  90   - [idle_inject/6]
    50  FF      46  90   - [idle_inject/5]
    50  FF      39  90   - [idle_inject/4]
    50  FF      32  90   - [idle_inject/3]
    50  FF      25  90   - [idle_inject/2]
    50  FF     245  90   - [irq/30-aerdrv]
    50  FF     244  90   - [irq/28-aerdrv]
    50  FF     243  90   - [irq/27-aerdrv]
    50  FF     242  90   - [irq/26-aerdrv]
    50  FF     236  90   - [irq/25-AMD-Vi]
    50  FF      18  90   - [idle_inject/1]
    50  FF      14  90   - [idle_inject/0]
    50  FF     116  90   - [idle_inject/15]
    50  FF     109  90   - [idle_inject/14]
    50  FF     102  90   - [idle_inject/13]
     1  FF      97  41   - [rcuc/12]
     1  FF      90  41   - [rcuc/11]
     1  FF      83  41   - [rcuc/10]
     1  FF     805  41   - [jpeg_dec]
     1  FF     804  41   - [vcn_enc1]
     1  FF     803  41   - [vcn_enc0]
     1  FF     802  41   - [vcn_dec]
     1  FF     801  41   - [sdma1]
     1  FF     800  41   - [sdma0]
     1  FF     799  41   - [comp_1.3.1]
     1  FF     798  41   - [comp_1.2.1]
     1  FF     797  41   - [comp_1.1.1]
     1  FF     796  41   - [comp_1.0.1]
     1  FF     795  41   - [comp_1.3.0]
     1  FF     794  41   - [comp_1.2.0]
     1  FF     793  41   - [comp_1.1.0]
     1  FF     792  41   - [comp_1.0.0]
     1  FF     791  41   - [gfx_0.0.0]
     1  FF      76  41   - [rcuc/9]
     1  FF      69  41   - [rcuc/8]
     1  FF      62  41   - [rcuc/7]
     1  FF      55  41   - [rcuc/6]
     1  FF      48  41   - [rcuc/5]
     1  FF      41  41   - [rcuc/4]
     1  FF      34  41   - [rcuc/3]
     1  FF      27  41   - [rcuc/2]
     1  FF      20  41   - [rcuc/1]
     1  FF      12  41   - [rcub/1]
     1  FF     118  41   - [rcuc/15]
     1  FF      11  41   - [rcu_preempt]
     1  FF     111  41   - [rcuc/14]
     1  FF     104  41   - [rcuc/13]
     1  FF      10  41   - [rcuc/0]
Does that give us any answers?

Cheers.
Death
Established Member
Posts: 372
Joined: Sun Oct 11, 2015 1:43 pm
Been thanked: 32 times

Re: Realtime priority?

Post by Death »

Thanks for the reply! Sorry for my delay.

Well I can see rtirq in the Manjaro repos so I could install it. But unless I'm mistaken, it looks like it's only for use with RT kernels..?

As for Xruns, I don't get many depending on my settings. Currently, I have an Audient ID4 set to 88200Hz sample rate & 512 sample buffer size and I get about 20-30 Xruns in a 24 hour period after rebooting. A good chunk of those usually happen when the soundcard is first initialised at boot.

Something that partly got me wondering was some bad performance I was having with many instances of u-he Diva open. The audio was stuttering and popping but no Xruns were being reported in my DAW or Cadence. My CPU seemed to be doing just fine too, although the DAW showed the CPU load almost maxing out. I tried changing the "Realtime Pirority" setting in Cadence from 10 - 80 - 95 but it didn't seem to help. Although, I did fix that issue by adjusting some settings in my instances of Diva. But I wonder if the issue wouldn't have existed at all had some of my settings been different..
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: Realtime priority?

Post by lilith »

Death wrote: Fri Apr 24, 2020 2:32 pm Thanks for the reply! Sorry for my delay.

Well I can see rtirq in the Manjaro repos so I could install it. But unless I'm mistaken, it looks like it's only for use with RT kernels..?

As for Xruns, I don't get many depending on my settings. Currently, I have an Audient ID4 set to 88200Hz sample rate & 512 sample buffer size and I get about 20-30 Xruns in a 24 hour period after rebooting. A good chunk of those usually happen when the soundcard is first initialised at boot.

Something that partly got me wondering was some bad performance I was having with many instances of u-he Diva open. The audio was stuttering and popping but no Xruns were being reported in my DAW or Cadence. My CPU seemed to be doing just fine too, although the DAW showed the CPU load almost maxing out. I tried changing the "Realtime Pirority" setting in Cadence from 10 - 80 - 95 but it didn't seem to help. Although, I did fix that issue by adjusting some settings in my instances of Diva. But I wonder if the issue wouldn't have existed at all had some of my settings been different..
I have the same problem with crackling but no xruns (viewtopic.php?f=27&t=21314), Which DAW are you using? It could be that the interface is the problem. Does it happen with Alsa and with Jack or only with Jack? Did you try 48kHz? Hope the interface is fine, cause it is also on my list :).
Death
Established Member
Posts: 372
Joined: Sun Oct 11, 2015 1:43 pm
Been thanked: 32 times

Re: Realtime priority?

Post by Death »

I remember seeing your thread quite recently actually. My interface is quite new so it's possible it could have an issue I haven't picked up on yet. But the thing is, I use a Windows DAW via WINE so I've got to suspect that the most. I can never get wineasio working but it would probably help quite a lot if I could..
puleglot
Established Member
Posts: 135
Joined: Thu Jan 23, 2020 3:14 pm
Has thanked: 3 times
Been thanked: 13 times

Re: Realtime priority?

Post by puleglot »

Death wrote: Fri Apr 24, 2020 2:32 pm Currently, I have an Audient ID4 set to 88200Hz sample rate & 512 sample buffer size and I get about 20-30 Xruns in a 24 hour period after rebooting. A good chunk of those usually happen when the soundcard is first initialised at boot.
Could you post lsusb -v output for this device? (preferably 'sudo lsusb -v -d [vendor]:[product] > somefile' and then attach resulting file).
Jack Winter
Established Member
Posts: 381
Joined: Sun May 28, 2017 3:52 pm

Re: Realtime priority?

Post by Jack Winter »

FWIW, wineasio has gotten a new maintainer and is at: https://github.com/falktx/wineasio

It's supposed to finally land at https://github.com/wineasio/wineasio someday.
Reaper/KDE/Archlinux. i7-2600k/16GB + i7-4700HQ/16GB, RME Multiface/Babyface, Behringer X32, WA273-EQ, 2 x WA-412, ADL-600, Tegeler TRC, etc 8) For REAPER on Linux information: https://wiki.cockos.com/wiki/index.php/REAPER_for_Linux
Death
Established Member
Posts: 372
Joined: Sun Oct 11, 2015 1:43 pm
Been thanked: 32 times

Re: Realtime priority?

Post by Death »

puleglot wrote: Sat Apr 25, 2020 2:29 pm Could you post lsusb -v output for this device? (preferably 'sudo lsusb -v -d [vendor]:[product] > somefile' and then attach resulting file).
Sorry, I don't get how to use that command exactly. I tried a couple of things but they didn't work.

lsusb shows it as this:

Code: Select all

Bus 003 Device 004: ID 2708:0003 Audient iD4
Jack Winter wrote: Sat Apr 25, 2020 8:36 pm FWIW, wineasio has gotten a new maintainer and is at: https://github.com/falktx/wineasio

It's supposed to finally land at https://github.com/wineasio/wineasio someday.
Yeh I found out that falktx took it over recently. I did follow his instructions on the github page but it never shows up as an option in my DAW. My DAW is using the system version of WINE which is installed via the repos so I don't know why it can't see wineasio. I've always really struggled to get it working..
Jack Winter
Established Member
Posts: 381
Joined: Sun May 28, 2017 3:52 pm

Re: Realtime priority?

Post by Jack Winter »

Did you do "regsvr32 wineasio.dll" and "wine64 regsvr32 wineasio.dll" ?
Reaper/KDE/Archlinux. i7-2600k/16GB + i7-4700HQ/16GB, RME Multiface/Babyface, Behringer X32, WA273-EQ, 2 x WA-412, ADL-600, Tegeler TRC, etc 8) For REAPER on Linux information: https://wiki.cockos.com/wiki/index.php/REAPER_for_Linux
glowrak guy
Established Member
Posts: 2315
Joined: Sat Jun 21, 2014 8:37 pm
Been thanked: 251 times

Re: Realtime priority?

Post by glowrak guy »

when the new wineasio arrived in the repository, I registered it with

'wine64 regsvr32 wineasio' ...sans the .dll, and it worked.
I have no idea whether any system code cares if the .dll part
is there or not, but accurate status clarifications would be cool.

Speaking of clarifications, running the above ps command, I saw the priority
setting I use in qjackctl (76) was listed as the priority for 'jackdbus auto'.

I then bumped up the priority in /etc/security/limits.conf from 95 to 99,
and upped the priority setting in qjackctl from 76 to 92, higher than
the sound hardwares themselves:

92 FF 1853 132 - /usr/bin/jackdbus auto
90 FF 651 130 - [irq/41-snd_hda_]
90 FF 645 130 - [irq/16-snd_ice1]
87 FF 4600 127 - .59/reaper
87 FF 3243 127 - a2jmidid -j default

Then I did some recordings, and performance was much better,
if in unscientific mode. The old saw was that 89 was the highest setting
to be used in qjackctl, if 99 was set in limits.conf.

Some systems have a folder with second limits.conf file,

/etc/security/limits.d/limits.conf ...sometimes auto-configured with useful settings
when some audio tool is installed...does system code know/care about files
of the same name, in nearby locations?

Does anyone know what is actually happening? I am now using ptiorities of 92 and 99
instead of 89 and 99, with apparently no ill effects.

Is the new jackd code just using 'the old math' but now able to ignore the higher priority setting
I've chosen? Is there code that parses both those numbers, and applies the results to
running audio tools? Is there a ticking timebomb ? :lol:

(sorry for all the non-coder jargon :( )

could there be an advantage to having a higher priority for
either reaper or a2jmidid, which currently are both at 87?

87 FF 4600 127 - .59/reaper
87 FF 3243 127 - a2jmidid -j default
Death
Established Member
Posts: 372
Joined: Sun Oct 11, 2015 1:43 pm
Been thanked: 32 times

Re: Realtime priority?

Post by Death »

Jack Winter wrote: Mon Apr 27, 2020 4:19 pm Did you do "regsvr32 wineasio.dll" and "wine64 regsvr32 wineasio.dll" ?
Yes I did. I followed the current guide here which was pretty convenient seeing I use Manjaro (Arch based) & FL Studio: https://github.com/wineasio/wineasio
It never shows up in FL Studio though so I have to select the crappy 'FL Studio ASIO' driver.

@glowrakguy - Sorry but I got a bit lost in what you were saying there. I might need to come back and read what you said when it isn't morning :/ I'm not that good with this stuff really.
merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: Realtime priority?

Post by merlyn »

glowrak guy wrote:Does anyone know what is actually happening? I am now using ptiorities of 92 and 99
instead of 89 and 99, with apparently no ill effects.
The actual values don't matter. SCHED_FIFO uses an arithmetic sort and processes threads with the highest priority first. It's about the order rather than the absolute value.
glowrak guy wrote:Then I did some recordings, and performance was much better,
Better in what way? Could you use a lower buffer size or use more plugins at the same buffer size?
glowrak guy wrote:

Code: Select all

92 FF 1853 132 - /usr/bin/jackdbus auto
90 FF 651 130 - [irq/41-snd_hda_]
90 FF 645 130 - [irq/16-snd_ice1]
87 FF 4600 127 - .59/reaper
87 FF 3243 127 - a2jmidid -j default
So we have JACK, internal soundcard, ICE1712, reaper, a2jmidi.

Do you use the internal soundcard? You could get rid of that. I normally put the soundcard interrupt above JACK. You appear to have found your system works better with JACK above the soundcard.

You only want the audio part of Reaper prioritised which may be what .59/reaper is. You don't want the graphics part or any other part of Reaper to have a high priority as it could take precedence over audio, which is what you're trying to avoid.
Post Reply