domjudge icon indicating copy to clipboard operation
domjudge copied to clipboard

Add cgroup v2 support

Open ss1h2a3tw opened this issue 4 years ago • 18 comments
trafficstars

Hi, currently runguard is using libcgroup to manipulate cgroup creation and controller settings. But some distributions are moving to cgroup v2: Fedora https://www.redhat.com/sysadmin/fedora-31-control-group-v2 RHEL https://www.redhat.com/ja/blog/world-domination-cgroups-rhel-8-welcome-cgroups-v2 Archlinux https://wiki.archlinux.org/index.php/cgroups#Enable_cgroup_v1

It will be nice if we have cgroup v2 support at future. libcgroup seems not to be supporting cgroupv2 in their C API, but since the file structure is unified, it shouldn't be too complex to just creating directories in cgroup's VFS.

ss1h2a3tw avatar Apr 30 '21 11:04 ss1h2a3tw

Note that Docker for Mac recently switched to cgroup v2 as well.

nickygerritsen avatar Dec 28 '21 13:12 nickygerritsen

Hi, my sysadmin refuses to install DOMJudge if it does not support cgroup v2. Are there any plans to upgrade DOMJudge?

rfleischer avatar Oct 31 '22 10:10 rfleischer

We have looked into this already but it is super non trivial. The API changed and some stuff is hard / not doable, so we need to investigate. I don't think it's on a timeline anytime soon.

nickygerritsen avatar Oct 31 '22 11:10 nickygerritsen

Unfortunately, it looks like we currently have to wait until libcgroup-dev becomes available in debian stable in version v3.0+. I very much would hope that this is next summer, but I am skeptical as the version is only in experimental right now.

meisterT avatar Dec 07 '22 18:12 meisterT

I was mistaken, cgroup v2 support is partially available libcgroup v2.0.

meisterT avatar May 06 '23 09:05 meisterT

systemd v255 (currently in rc3 or something) will officially remove cgroup v1 AFAIK, so from now on, DomJudge won't run anymore on up-to-date systems.

RaitoBezarius avatar Nov 28 '23 19:11 RaitoBezarius

Hi, I wanted to ask if it is soon planned to support cgroups v2, as the deprecation of cgroups v1 is coming closer...

holmes111 avatar Feb 19 '24 12:02 holmes111

Hi, I wanted to ask if it is soon planned to support cgroups v2, as the deprecation of cgroups v1 is coming closer...

The coming months we are not planning to implement larger/harder features. As far as I'm aware (but didn't do extensive research on the subject) we can still use cgroupv1 as it is still supported with the kernel but only systemd will not support it anymore. Do you have more information on the subject? The main issue is that not all needed features are implemented in CGroupV2 so we can't do a 1 to 1 translation.

According to the kernel (https://github.com/torvalds/linux/blob/b401b621758e46812da61fa58a67c3fd8d91de0d/tools/testing/selftests/bpf/cgroup_helpers.h#L32) cgroupv1 is still tested for.

vmcj avatar Feb 19 '24 22:02 vmcj

Pull requests adding cgroupv2 functionality are of course welcome!

meisterT avatar Feb 20 '24 05:02 meisterT

I have a WiP port of runguard to cgroupv2 https://github.com/Johnnynator/domjudge/tree/cgroup with some assumptions that are not correct for domjudge (would need minor adjustments since the port is configured to create a systemd slice and scope with different naming than the old group) (Tested in a setup with jobe)

The main issue is that not all needed features are implemented in CGroupV2 so we can't do a 1 to 1 translation.

The only major difference I noticed was that memory is now hard split between memory and swap and no combined limit_in_bytes I did not notice any other major differences

I was mistaken, cgroup v2 support is partially available libcgroup v2.0.

Anything before v3.1 has bugs that would need workarounds in the code.

Johnnynator avatar Feb 28 '24 15:02 Johnnynator

Thanks for this! We will look into your code to see what we can reuse (and of course credit you if we do).

nickygerritsen avatar Feb 29 '24 07:02 nickygerritsen