Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 670714 - sys-apps/portage better cgroup v1 and v2 support
Summary: sys-apps/portage better cgroup v1 and v2 support
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Enhancement/Feature Requests (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Portage team
Depends on:
Reported: 2018-11-08 22:31 UTC by Forza
Modified: 2022-04-06 14:37 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Forza 2018-11-08 22:31:19 UTC
It would be very beneficial if portage supported setting various cgroups option s such as cpu.weight and memory.high/max.

Currently portage supports cgroups v1 to group all emerge activities under one cgroup subtree. It would be great if it also supported cgroups v2. 

make.conf could be updated with something like this:

FEATURES="cgroups cgroup2" 

CGROUP2="cpu.weight=100 memory.high=1g"

The great advantage is to be able to limit recourses for all emerge processes as a whole, rather than per ebuild instance.

This is implemented in openrc already.
Comment 1 Forza 2018-12-14 20:49:23 UTC
I made a quick wrapper script to work with cgroups v2 with portage. It requires that PORTAGE_NICENESS and FEATUERS=cgroup are off, and that cgroups v2 (unified) is enabled and mounted correctly. (execute commands in a cgroup)

To use it simply do: # cgexec -c50 emerge xxx/yyy

Most people do not use purely cgroups v2 so cgexec wont work there then. It would be better with a generic solution that works with other features, including both systemd and OpenRC (I use and prefer OpenRC).