diff --git a/NEWS b/NEWS index 7c362d9e0..d60469c65 100644 --- a/NEWS +++ b/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 diff --git a/doc/user.rst b/doc/user.rst index 70093874a..15724091a 100644 --- a/doc/user.rst +++ b/doc/user.rst @@ -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. diff --git a/src/thread/Util.cxx b/src/thread/Util.cxx index 5b61b62be..07c224ddd 100644 --- a/src/thread/Util.cxx +++ b/src/thread/Util.cxx @@ -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 diff --git a/systemd/system/mpd.service.in b/systemd/system/mpd.service.in index 2c4007d25..1086eed1a 100644 --- a/systemd/system/mpd.service.in +++ b/systemd/system/mpd.service.in @@ -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, ... diff --git a/systemd/user/mpd.service.in b/systemd/user/mpd.service.in index eea52d951..0f8c3e9ee 100644 --- a/systemd/user/mpd.service.in +++ b/systemd/user/mpd.service.in @@ -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, ...