File pipewire-pulse.service.d-user-limits.conf of Package pipewire
[Unit]
ConditionUser=!@system
# https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/752#note_809325
After=pipewire.service
Requires=pipewire.service
[Service]
NoNewPrivileges=false
# https://unix.stackexchange.com/questions/589175/how-to-change-linux-scheduling-policy-for-user-systemd-file
#AmbientCapabilities=CAP_SYS_NICE
# https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1840#note_1193304
Environment=GLIBC_TUNABLES=glibc.malloc.mmap_threshold=131072
LimitMEMLOCK=4G
LimitAS=4G
MemoryMax=4G
LimitNOFILE=32768
LimitMSGQUEUE=1048576
LimitSIGPENDING=98304
LimitRTPRIO=35:39
RestrictRealtime=false
# these will only apply to the main thread
Nice=-14
CPUSchedulingPolicy=fifo
CPUSchedulingPriority=3
CPUSchedulingResetOnFork=false
# 1/3 for high realtime or 2/0 for highest "best effort"
# systemd still just craps itself instead of setting realtime priority before dropping root privileges
# /usr/lib/systemd/system/user@.service needs 'CapabilityBoundingSet/AmbientCapabilities=CAP_SYS_NICE' to unlock that, see `man systemd.exec`
IOSchedulingClass=2
IOSchedulingPriority=2
OOMScoreAdjust=-989
TimerSlackNSec=332