B1;4002;0cOn Fri, 18.09.15 14:11, Francis Moreau ([email protected]) wrote:

> Hi,
> 
> I'm trying to understand how cgroup is used by systemd and having the
> following behaviour that I don't understand.
> 
> I've created a slice "myslice.slice" with this resource constraint
> "MemoryLimit=1024" and started it.
> 
> I was expecting to find a trace of myslice in /sys/fs/cgroup/memory
> folder but I can't find anything.

systemd realizes croups only when we add processes to it.

> I  put a process inside the slice (with the help of systemd-run
> --slice=myslice), but nothing was created under /sys/fs/cgroup/memory
> either.

So, this works fine for me:

# systemd-run --slice=my-deep-slice.slice -p MemoryLimit=3G /bin/sleep 99999

It creates the specified slice, and places the new service in it, then
adds the process in it and sets the memory.limit_in_bytes= attribute
on the services' cgroup.

Does this not work for you? Which systemd version are you using?

> I was expecting that "myslice.slice" would have its own directory
> inside /sys/fs/cgroup/memory directory (ie inside the memory
> controller) and the memory constraint applied to that directory and
> hence all its children.

Correct. But again, we only realize groups when we really need to.

> But it seems I'm missing something.
> 
> Could anybody enlight me please ?
> 
> Also I'm a bit lost regarding kernel cgroup and its reworked API. Does
> systemd already use this new API or is it still using the old/broken
> one ?

Yes, the concept of scopes, services and slices and how they are
mapped to cgroupfs is fully implemented. We currently don't expose all
controllers and all settings, but that's mostly because the
controllers are awful and in progress of being fixed, and we only want
to expose them as soon as they are cleaned up and here to stay with
their new settings.

In the most recent systemd release we even support the new kernel
unified hierarchy now, but you have to select at boot time which one
you want: the legacy one as before, or the unified one.

Lennart

-- 
Lennart Poettering, Red Hat
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to