[systemd-devel] Slice question

Lennart Poettering lennart at poettering.net
Wed May 15 09:08:11 UTC 2019

On Mi, 15.05.19 11:04, Ulrich Windl (Ulrich.Windl at rz.uni-regensburg.de) wrote:

> Hi!
> When I tried to put the instances of my service into a specific slice (by only specifying the name), I just got an error message.
> I had:
> [Service]
> Slice=something
> in the service unit file. Amazingly systemd does put my instances in a slice when I removed that Slice line. The slice is named "system-<my_service>.slice".
> Three questions:
> 1) Is there a simple way to just rename the default slice?

No. The default slice for system services (system.slice) is built into systemd.

> 2) Most services don't seem to have a slice associated
> (e.g. postfix.service, logd.service). What are the conditions that a
> slice is created?

Services are by default placed in "system.slice". All services in
fact. That said, template services get their own subslice of that per
slice. For example if you have "foobar at .service", then it gets placed
into "system-foobar.slice", i.e. one slice further down the tree.

> 3) Is there a useful example for slice settings?
> systemd.resource-control(5) is not really helpful (e.g. What is all
> that "accounting" useful for?)...

Accounting turns on accounting of resources. You will then see
additional output in "systemctl status" and "systemctl show" about
resource usage. Moreover "systemd-cgtop" will actually show useful
columns if you turn on specific forms of accounting for your services.


Lennart Poettering, Berlin

More information about the systemd-devel mailing list