]> git.ipfire.org Git - thirdparty/systemd.git/commit
core: do not set up cgroup runtime on coldplug 33258/head
authorMike Yuan <me@yhndnzj.com>
Wed, 5 Jun 2024 18:45:12 +0000 (20:45 +0200)
committerMike Yuan <me@yhndnzj.com>
Fri, 28 Jun 2024 13:43:21 +0000 (15:43 +0200)
commitf26b2ec46118a4493608618da2253bb9dfc6b517
tree57ed80fd584bf88a095c8960a0c4fb10b5745403
parent8d178f702d7c3b632233299b98158e34ef171c74
core: do not set up cgroup runtime on coldplug

Currently, unit_setup_cgroup_runtime() is called in
various _coldplug() functions if the unit is not inactive.
That seems unnecessary though, and kinda defeats the purpose
of CGroupRuntime. If we need to fork off a process for the unit
or got something during deserialization, the CGroupRuntime
would be automatically set up by unit_prepare_exec() /
cgroup_runtime_deserialize_one(). Otherwise it would mean
the cgroup doesn't exist and we don't need to allocate
that in the first place.

Plus, note that socket units might also carry a cgroup with
ExecStartPre=/ExecStartPost=/... Hence the existing code
is really inconsistent.
src/core/mount.c
src/core/service.c
src/core/swap.c