Fwd: Using cgroups v2 for “simple” tasks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Apologies for the duplicated message, but the one I sent earlier seems to have 
missed the target: it does not appear in the archives. Maybe I should have 
subscribed to the list before sending it…
--- Begin Message ---
Greetings,

This machine is running under Fedora 32 Workstation Edition which means that, 
among other things, cgroups are under a unified hierarchy.

$ sdver=(`systemctl --version | tail -1`)
$ for i in "${sdver[@]}"; do printf "%s\n" "$i"; done | grep "hierarchy"
default-hierarchy=unified

Before the upgrade, I was using Fedora 30 and libcgroup v1, leveraging with 
that the libcgroup-tools to run some processes under certain constraints. 
Since the upgrade, my scripts broke. Here is an example:

```bash
## libcgroup v1
# Configuring a group
TGT='foo'
GRP='woe'
let M=(500 * 1024 * 1024)
let C=250000
cgcreate -a "${TGT}:${TGT}" -t "${TGT}:${TGT}" -g memory:"$GRP" -g cpu:"$GRP"
printf "%d" "$M" > /sys/fs/cgroup/memory/"$GRP"/memory.limit_in_bytes
printf "%d" "$C" > /sys/fs/cgroup/cpu/"$GRP"/cpu.cfs_quota_us

# Using the new group
cgexec --sticky -g "memory,cpu:${GRP}" <SOME-COMMAND>
```

That does not cut it anymore. I tried to follow the manual and it led me to 
write something like the file below.

# </etc/cgconfig.conf>
group woe {
    perm {
        task {
            uid = foo;
            gid = foo;
        }
    }

    memory {
        memory.high = 524288000;
    }

    cpu {
        cpu.max = 0500000 1000000;
    }
}

My limited understanding of the documentation left me with the impression 
systemd would create the cgroup `foo` after a reboot. That, of course, turned 
out to be false, I would not be here otherwise.

So, here is where your help would be greatly appreciated: how to use the 
cgcreate command and the like under libcgroup v2? Alternatively, if the way is 
by configuration files, where to create them and how to enforce what they 
stipulate?

Thanks in advance.



--- End Message ---
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux