[systemd-devel] Do not realize and migrate cgroups multiple times / test suite patch
martin.pitt at ubuntu.com
Sat Dec 13 08:15:02 PST 2014
Lennart Poettering [2014-12-09 2:37 +0100]:
> hashmap_put() will actually compare the string, not the pointer to
> it. Our hashmap implementation gets a hash function pointer as well as
> an element comparison function as input, to ensure that that works
Ah right. I understand how these work now, and I extended the test
case to cover this case (equal key, but different pointer).
So the problem in unit_create_cgroups() was that hashmap_put()
returned 0 for the already existing "" key, but the function does not
check that case and re-initializes and re-migrates the cgroup (in
particular, -.slice) over and over again. The recent commit 7b3fd631
seems to mitigate this, pids don't move back to -.slice any more.
However, unit_create_cgroups() still seems to be quite wasteful: It
still gets called dozens of time for -.slice for every unit that gets
started, and thus calls cg_create_everywhere() for the already
existing cgroup. Why doesn't this function just check if
u->cgroup_path already exists, and if so just return right away? Are
there situations where the same unit cgroup needs to be realized and
pids migrated to it multiple times?
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1452 bytes
Desc: not available
More information about the systemd-devel