thread/Util: lower the real-time priority from 50 to 40
On linux-rt, kernel IRQ threads are configured with priority=50, and this change configures MPD somewhat below that priority, leaving some room for other programs to be configured in between. Closes https://github.com/MusicPlayerDaemon/MPD/issues/643
This commit is contained in:
parent
2f3e94f8d0
commit
c89c7f71a2
1
NEWS
1
NEWS
|
@ -28,6 +28,7 @@ ver 0.22 (not yet released)
|
|||
- jack: add option "auto_destination_ports"
|
||||
- jack: report error details
|
||||
- pulse: add option "media_role"
|
||||
* lower the real-time priority from 50 to 40
|
||||
* switch to C++17
|
||||
- GCC 7 or clang 4 (or newer) recommended
|
||||
|
||||
|
|
|
@ -804,13 +804,13 @@ This is only possible you allow :program:`MPD` to do it. This privilege is contr
|
|||
|
||||
.. code-block:: none
|
||||
|
||||
ulimit -HS -r 50; mpd
|
||||
ulimit -HS -r 40; mpd
|
||||
|
||||
Or you can use the :command:`prlimit` program from the util-linux package:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
prlimit --rtprio=50 --rttime=unlimited mpd
|
||||
prlimit --rtprio=40 --rttime=unlimited mpd
|
||||
|
||||
The systemd service file shipped with :program:`MPD` comes with this setting.
|
||||
|
||||
|
@ -828,10 +828,10 @@ You can verify whether the real-time scheduler is active with the ps command:
|
|||
PID TID CLS RTPRIO COMMAND
|
||||
16257 16257 TS - mpd
|
||||
16257 16258 TS - io
|
||||
16257 16259 FF 50 rtio
|
||||
16257 16259 FF 40 rtio
|
||||
16257 16260 TS - player
|
||||
16257 16261 TS - decoder
|
||||
16257 16262 FF 50 output:ALSA
|
||||
16257 16262 FF 40 output:ALSA
|
||||
16257 16263 IDL 0 update
|
||||
|
||||
The CLS column shows the CPU scheduler; TS is the normal scheduler; FF and RR are real-time schedulers. In this example, two threads use the real-time scheduler: the output thread and the rtio (real-time I/O) thread; these two are the important ones. The database update thread uses the idle scheduler ("IDL in ps), which only gets CPU when no other process needs it.
|
||||
|
|
|
@ -101,7 +101,7 @@ SetThreadRealtime()
|
|||
{
|
||||
#ifdef __linux__
|
||||
struct sched_param sched_param;
|
||||
sched_param.sched_priority = 50;
|
||||
sched_param.sched_priority = 40;
|
||||
|
||||
int policy = SCHED_FIFO;
|
||||
#ifdef SCHED_RESET_ON_FORK
|
||||
|
|
|
@ -12,8 +12,8 @@ ExecStart=@prefix@/bin/mpd --no-daemon
|
|||
# periodic wakeups which are unnecessary if MPD is not playing.
|
||||
#WatchdogSec=120
|
||||
|
||||
# allow MPD to use real-time priority 50
|
||||
LimitRTPRIO=50
|
||||
# allow MPD to use real-time priority 40
|
||||
LimitRTPRIO=40
|
||||
LimitRTTIME=infinity
|
||||
|
||||
# disallow writing to /usr, /bin, /sbin, ...
|
||||
|
|
|
@ -12,8 +12,8 @@ ExecStart=@prefix@/bin/mpd --no-daemon
|
|||
# periodic wakeups which are unnecessary if MPD is not playing.
|
||||
#WatchdogSec=120
|
||||
|
||||
# allow MPD to use real-time priority 50
|
||||
LimitRTPRIO=50
|
||||
# allow MPD to use real-time priority 40
|
||||
LimitRTPRIO=40
|
||||
LimitRTTIME=infinity
|
||||
|
||||
# disallow writing to /usr, /bin, /sbin, ...
|
||||
|
|
Loading…
Reference in New Issue