On Wed, Mar 16, 2022 at 5:53 PM Lennart Poettering <lenn...@poettering.net> wrote:
> On Mi, 16.03.22 17:30, Felip Moll (fe...@schedmd.com) wrote: > > > AFAIK RemainAfterExit for services actually does cleanup the cgroup tree > if > > there are no more processes in it. > > It doesn't do that if delegation is on (iirc, if not I'd consider that > a bug). Same logic should apply here. > > I will recheck that, but I am quite sure that on some tests I did the cgroup was cleaned up on a delegated service after the main pid terminated. > > If that behavior of keeping the cgroup tree even if there are no pids is > > what you agree with, then I coincide is a good idea to include this > option > > to scopes. > > Yes, that is what I was suggesting this would do. > > Excellent. > > Or are you saying that I can just migrate processes wildly without > > informing systemd and just doing an 'echo > cgroup.procs' from one > > non-delegated tree to my delegated subtree? > > yeah, you can do that. > > Ok, so I understood that incorrectly from a former paragraph you wrote in our first e-mails. you said: > Migrating processes wildly between cgroups is messy, because it fucks > up accounting and is restricted permission-wise. Typically you want to > create a cgroup and populate it, and then stick to that. There, I understood you were referring to "systemd" accounting, not "kernel" accounting. This has been a big misunderstanding for this issue. > Note that (independently of systemd) you shouldn't migrate stuff to > aggressively, since it fucks up kernel resource accounting. i.e. it is > wise to minimize process migration in cgroups and always migrate plus > shortly after exec() > Yeah, that makes sense and I am aware of it. I am migrating before any real work is done, exactly as you describe. I will continue a bit more with this and inform you on what I see, but we seem to be close to a solution. Thank you!.