[systemd-devel] Setting low-level cgroups attributes in systemd
Lennart Poettering
lennart at poettering.net
Tue Dec 10 09:24:35 PST 2013
On Mon, 09.12.13 10:31, Joe Miller (joeym at joeym.net) wrote:
> It appears that the .slice changed described here[1] removed all ability to
> set low-level cgroups settings, is that correct?
Yes, that is correct. With the new code only attributes that systemd
understands can be set, nothing else.
> For cgroup attributes that systemd does not natively support
> (example: cpu.cfs_period_us and cpu.cfs_quota_us) it was previously
> possible to set these
>
> 1. via unit files: ControlGroupAttribute=cpu.cfs_period_us 500
> 2. or at runtime: systemctl --runtime set-cgroup-attr thing.service
> cpu.cfs_period_us 500
>
> I find the ability to set cgroup attrs not supported natively by systemd
> useful, will this be added back to systemd or will systemd support all
> cgroup attributes?
The problem with supporting these generic attributes is that they all
have very different semantics how they can be reset and what writing to
them actually does (some overwrite previous settings, others are lists
that the new data you write is appended to, even others work more like a
dictionary). Also, a big chunk of them are going to go away with Tejun's
"sane behaviour" cgroup rework.
We are happy to support more options high-level in systemd, however,
there needs to be a clear perspective that they are options that are
going to stay. The last time we discussed the cfs attributes in
particular Tejun indicated they wouldn't stay the way they are.
Now, if there at least is a clear perspective how they are going to look
like in future in the kernel, then we can add support for them now
already and add a bit of compat code that tries to translate them to the
old cgroup kernel api, but I am not sure whether that is possible for
the cfs attributes.
A dirty work-around for the time being is to simply set these properties
via a shell fragment. You can use the "%c" specifier which will tell you
the cgroup path of a service, use that in some ExecStartPre= script that
initializes these for you.
If you'd like to see proper support for this stuff (which I certainly
want), then we need to discuss with Tejun how we can expose these props
already now.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list