[systemd-devel] Question about the systemd slice hierarchy

Michal Koutný mkoutny at suse.com
Mon Jun 30 11:45:57 UTC 2025


Hello.

On Mon, Jun 30, 2025 at 07:45:53AM +0000, Matthew Chae <Matthew.Chae at axis.com> wrote:
> I have some questions about "Example 1. Enabling and disabling controllers" from the slice-related man page linked below.
> https://www.freedesktop.org/software/systemd/man/latest/systemd.resource-control.html#
> 
> First, under system.slice, there is a slice named b.slice. Is this possible?

No, the name encodes the path in reality.

> Shouldn't it be named system-b.slice instead?

That would be indeed the proper name of the slice that is pictured
there. You can fix it here [1] :-)

> Second, under user.slice, there's a user at 1000.service, and under that,
> there are app.slice and session.slice.

If you check user at .service definition, you find that it sets Delegate=
-- this means that the service as seen from PID1 perspective was
delegated the manipulation of its (service's) cgroup subtree.

> Can a slice like app.slice exist under a service unit like user at 1000.service?

This app.slice is a slice unit of the _user_ instance of systemd. It's
full system path would be:
	/user.slice/user-1000.slice/user at 1000.service/app.slice

(app.slice is a random internal subcgroup for PID1)

> If that's possible, what would be a use case for this kind of structure?

It's turtles all the way down. One use case is structuring of processes
by user's desktop environment, some more info is in [2].

HTH,
Michal


[1] https://github.com/systemd/systemd/blob/main/man/systemd.resource-control.xml
[2] https://systemd.io/DESKTOP_ENVIRONMENTS/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20250630/bf5a93cb/attachment.sig>


More information about the systemd-devel mailing list