[systemd-devel] Do not realize and migrate cgroups multiple times / test suite patch

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Sat Feb 14 09:11:24 PST 2015


On Tue, Feb 03, 2015 at 10:49:01PM +0100, Lennart Poettering wrote:
> On Sat, 13.12.14 17:15, Martin Pitt (martin.pitt at ubuntu.com) wrote:
> 
> > Hello Lennart,
> > 
> > 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
> > > correctly.
> > 
> > Ah right. I understand how these work now, and I extended the test
> > case to cover this case (equal key, but different pointer).
> 
> The patch for this has been merged, apparently.
> 
> > 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?
> 
> unit_create_cgroups() is invoked from unit_realize_cgroup_now(), which
> exits early if the unit is already realized for all controllers
> that the unit needs. Thus, unit_create_cgroups() should not be called
> that often, but only when the mask of controllers to realize changes.
Martin,

is there anything left to fix here?

Zbyszek


More information about the systemd-devel mailing list