<div dir="ltr">I'm running on a kernel with CONFIG_RT_GROUP_SCHED=y. I understand that this is counter to the recommendation in the README ("We recommend to turn off Real-Time group scheduling in the kernel when using systemd...."), but I don't have control over the kernel configuration.<div><br></div><div>On this system, it appears that starting "docker" (docker-ce-17.06.0.ce-1) results in the creation of new cpu cgroups that for some reason apply to systemd services. That is, after starting docker, /sys/fs/cgroup/cpu/system.slice exists when previously it didn't.<div><br></div><div>Once this happens, a service that attempts to set realtime scheduling (SCHED_RR) via sched_setscheduler() will fail, presumably because the cgroup has no realtime budget in cpu.rt_runtime_us.</div><div><br></div><div>In older versions of systemd one could handle this using the directives described in <a href="https://www.freedesktop.org/wiki/Software/systemd/MyServiceCantGetRealtime/">https://www.freedesktop.org/wiki/Software/systemd/MyServiceCantGetRealtime/</a>, but unfortunately that document, despite being the number 1 search result for pretty much anything involving "systemd" and "realtime", is obsolete and those directives no longer exist.<br clear="all"><div><br></div><div>Is there a way to make this work correctly with modern versions of systemd? I've hacked around it for now by creating /etc/systemd/system/myservice.service.d/realtime.conf that moves the service back to the root cgroup and then uses chrt to set the scheduling policy:</div><div><br></div><div> [Service]<br></div><div><div> ExecStartPost=/bin/cgclassify -g cpu:/ $MAINPID<br></div><div> ExecStartPost=/bin/chrt -r -p 99 $MAINPID</div></div><div><br></div><div>...and while that works, it seems really ugly. I've attempted to set CPUSchedulingPolicy=rr in the unit, but that simply results in systemd failing to start the service and logging "Failed at step SETSCHEDULER spawning...".</div><div><br></div><div>Is there a better way of addressing this?</div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Lars Kellogg-Stedman <<a href="mailto:lars@redhat.com">lars@redhat.com</a>><div><br></div></div></div>
</div></div></div>