[systemd-devel] Antw: [EXT] Re: Moving a service from one systemd slice to another..

Lennart Poettering lennart at poettering.net
Thu May 7 07:02:30 UTC 2020


On Do, 07.05.20 08:49, Ulrich Windl (Ulrich.Windl at rz.uni-regensburg.de) wrote:

> >>> Lennart Poettering <lennart at poettering.net> schrieb am 06.05.2020 um 17:16
> in
> Nachricht
> <19374_1588778203_5EB2D4DB_19374_121_1_20200506151636.GL89018 at gardel-login>:
> > On Mo, 04.05.20 11:52, nitish nagesh (nagesh.nitish at gmail.com) wrote:
> >
> >> Hello,
> >>
> >>    We have this odd want to move a daemon between different systemd
> slices.
> >> Not sure if that's even a valid thing to do, but here is the
> >> requirement.
> >
> > The Linux kernel gets a bit confused with accounting if you migrate
> > running processes between cgroups. One usually shouldn't do that
> > except when forking off/execing new stuff.
>
> IMHO Linux should either handle the case correctly, or forbid it.

Well, until recently there wasn't even a clone-into-cgroup API in the
Linux kernel. Which meant you first had to fork off your process and
then afterwards migrate it to the destination cgroup, i.e. it first
had to be forked off and then migrated because there was no other
API. This has been fixed now however, and we can clone directly into a
cgroup, so that the process never exists elsewhere. we are not using
that in systemd yet, but with that they could in theory forbid
migration entirely and have accounting "atomic", i.e. that a process
exists in a specific cgroup or in another for its entirely lifetime,
but never migrates.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list