Welcome to the Linux Foundation Forum!

LAB 2.6 foo.slice doesn't have any impact

Somehow CPU usage stays 100%.
I also tried to make a [Slice] in foo.service.
I did the stop / reload-deamon /start.
I tried reboot once.
I tried to make /usr/lib/systemd/system/foo.slice
Operating System is Manjaro.

/etc/systemd/system >>> cat foo.service foo.slice

[Unit]
Description=Example service unit to run stress]
Slice=foo.slice
[Service]
ExecStart=/usr/bin/stress --cpu 2 --io 2 --vm 4 --vm-bytes 256M
[Install]
WantedBy=multi-user.target


[Unit]
Description="stress slice"
[Slice]
CPUQuota=30%

It just stays under the system.slice

/etc/systemd/system >>> sudo systemctl status -l foo.service                                                                                       [1]
● foo.service - Example service unit to run stress]
     Loaded: loaded (/etc/systemd/system/foo.service; disabled; vendor preset: disabled)
     Active: active (running) since Fri 2021-02-26 17:12:40 CET; 57s ago
   Main PID: 22562 (stress)
      Tasks: 9 (limit: 4555)
     Memory: 697.5M
     CGroup: /system.slice/foo.service
             ├─22562 /usr/bin/stress --cpu 2 --io 2 --vm 4 --vm-bytes 256M
             ├─22563 /usr/bin/stress --cpu 2 --io 2 --vm 4 --vm-bytes 256M
             ├─22564 /usr/bin/stress --cpu 2 --io 2 --vm 4 --vm-bytes 256M
             ├─22565 /usr/bin/stress --cpu 2 --io 2 --vm 4 --vm-bytes 256M
             ├─22566 /usr/bin/stress --cpu 2 --io 2 --vm 4 --vm-bytes 256M
             ├─22567 /usr/bin/stress --cpu 2 --io 2 --vm 4 --vm-bytes 256M
             ├─22568 /usr/bin/stress --cpu 2 --io 2 --vm 4 --vm-bytes 256M
             ├─22569 /usr/bin/stress --cpu 2 --io 2 --vm 4 --vm-bytes 256M
             └─22570 /usr/bin/stress --cpu 2 --io 2 --vm 4 --vm-bytes 256M

Feb 26 17:12:40 blabla systemd[1]: Started Example service unit to run stress].
Feb 26 17:12:40 blabla stress[22562]: stress: info: [22562] dispatching hogs: 2 cpu, 2 io, 4 vm, 0 hdd

Comments

  • lee42x
    lee42x Posts: 380

    Thank you for bringing this to our attention, investigating.
    Lee

  • benaep
    benaep Posts: 3

    Hi Lee

    I just tied to add the connection of the .slice under [Service] as in the Arch Wiki but it's not working either.
    https://wiki.archlinux.org/index.php/Cgroups#Grouping_unit_under_a_slice

    I also checked the solutions of the lab exercise but the Slice=foo.slice entry is missing completely. (Solutions are attached to the post)

    /usr/.../systemd/system >>> cat foo.service foo.slice   
    
    [Unit]
    Description=Example service unit to run stress
    [Service]
    Slice=foo.slice
    ExecStart=/usr/bin/stress --cpu 4 --io 4 --vm 2 --vm-bytes 256M
    [Install]
    WantedBy=multi-user.target
    
    [Unit]
    Description="stress slice"
    [Slice]
    CPUQuota=30%
    
  • lee42x
    lee42x Posts: 380

    Is the script track-STRESS.sh showing system.slice or foo.slice in the output?
    There may have been a default config option change causing cgroupsV2 to be activated.

    Thanks Lee

  • benaep
    benaep Posts: 3

    system.slice as in the systemctl status -l foo under CGroup: CGroup: /system.slice/foo.service

  • lee42x
    lee42x Posts: 380

    That may be the clue I was looking for, it should be foo.slice. I'll check it out and get back to you.

    Lee

Categories

Upcoming Training