File pipewire.service.d-user-limits.conf of Package pipewire
[Unit]
ConditionUser=!@system
Wants=pipewire-media-session.service
[Service]
NoNewPrivileges=false
# https://unix.stackexchange.com/questions/589175/how-to-change-linux-scheduling-policy-for-user-systemd-file
#AmbientCapabilities=CAP_SYS_NICE
LimitMEMLOCK=4G
LimitAS=4G
MemoryMax=4G
LimitNOFILE=1048576
LimitMSGQUEUE=infinity
LimitSIGPENDING=infinity
LimitNPROC=1048576
LimitNICE=-14
LimitRTPRIO=45:49
LimitRTTIME=infinity
RestrictRealtime=false
# these will only apply to the main thread
Nice=-14
CPUSchedulingPolicy=fifo
CPUSchedulingPriority=5
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=0
OOMScoreAdjust=-999
TimerSlackNSec=332