[systemd-devel] Realtime scheduling with CONFIG_RT_GROUP_SCHED=y
Lars Kellogg-Stedman
lars at redhat.com
Wed Jul 12 15:41:55 UTC 2017
On Thu, Jul 6, 2017 at 10:56 AM, Lars Kellogg-Stedman <lars at redhat.com>
wrote:
> In older versions of systemd one could handle this using the directives
> described in https://www.freedesktop.org/wiki/Software/systemd/
> MyServiceCantGetRealtime/, 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.
>
> 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:
>
It looks like systemd sets up cgroups before calling ExecStartPre, which
means I can emulate the behavior of those obsolete directives by running:
ExecStartPre=/bin/sh -c 'echo 550000 >
/sys/fs/cgroup/cpu,cpuacct/cpu.rt_runtime_us'
ExecStartPre=/bin/sh -c 'echo 200000 >
/sys/fs/cgroup/cpu,cpuacct/system.slice/cpu.rt_runtime_us'
ExecStartPre=/bin/sh -c 'echo 200000 >
/sys/fs/cgroup/cpu,cpuacct/system.slice/myservice.service/cpu.rt_runtime_us'
In an environment where CONFIG_RT_GROUP_SCHED is set, is this the best way
of addressing the problem?
--
Lars Kellogg-Stedman <lars at redhat.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20170712/9ccf6203/attachment.html>
More information about the systemd-devel
mailing list