[systemd-devel] Set cgroup attributes not supported by systemd - what do you recommend?

Lennart Poettering lennart at poettering.net
Fri Jan 24 02:37:49 PST 2014


On Thu, 23.01.14 11:55, Barry Scott (barry.scott at onelan.co.uk) wrote:

> I am running systemd 208 on Fedora 20.
> 
> There are 2 cpu cgroup attributes that I need to set to allow realtime for 
> some daemons: cpu.rt_period_us and cpu.rt_runtime_us.
> 
> For the memory cgroup I need to set memory.memsw.limit_in_bytes for one of
> my slices.
> 
> Do you plan to add support for setting these attributes in a future systemd 
> update?

Yes, but don't hold your breath...

Basically, we are currently only exposing attributes that Tejun (the
kernel cgroups maintainer) considers to be attributes that are going to
be available after the cgroup rework is finished. The memsw and RT stuff
does not really fall into that category, it is not clear that they will
be available after the kernel clean-up, and if they will, then  not
necessarily with the same semantics.

> Until there is support I could have a .service run code to setup the 
> attributes for the .slice's before services that need the changes.
> 
> Would that be a suitable workaround until there is support in systemd?

For now, I recommend adding a small ExecStartPre= script into the
respective services, that gets passed "%c" which resolves to the cgroup
path. Then, in that script simply echo the values you need into the
right attributes.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list