Sample Header Ad - 728x90

cgroups v2 and systemd missing memory controller on individual user slices

0 votes
0 answers
244 views
I have several Rocky 8 systems configured for cgroups v2 with systemd.unified_cgroup_hierarchy=1 set in kernel boot parameters. On these systems I set something like
systemctl set-property user.slice MemoryMax=498G
systemctl set-property user.slice MemoryHigh=494G
systemctl set-property user-0.slice MemoryMin=100M
which is supposed to prevent normal users in sum from using all the system memory and make sure the root user has at least 100M always available for its slice so I can ssh into the box even with the other users are using all 498G Anyway, on some boxes these settings seem to have at least "applied" just fine with after reboot I see
/sys/fs/cgroup/user.slice/memory.max:534723428352
/sys/fs/cgroup/user.slice/memory.high:530428461056
/sys/fs/cgroup/user.slice/user-0.slice/memory.min:104857600
On other boxes though the user-0.slice does not work. In fact there is no memory.min or other memory limit files at all in /sys/fs/cgroup/user.slice/user-0.slice or for other users in these boxes. Also on these boxes /sys/fs/cgroup/user.slice/cgroup.subtree_control is empty (while it has "memory pids" on the boxes where it works) I cannot figure out what controls this. If on the boxes it is not working I do
echo "+memory +pids" > /sys/fs/cgroup/user.slice/cgroup.subtree_control
I then see the memory files needed in /sys/fs/cgroup/user.slice/user-0.slice but the property for memory.min is not set. So I try doing a
systemctl daemon-reload
to see if systemd will set it. Well, instead of setting it systemd for some reason removes my change to user.slice/cgroup.subtree_control so the memory.min file disappears from user-0.slice I cannot figure out what is going on here. How do I force "+memory +pids" at boot for user.slice/cgroup.subtree_control and have it survive a systemctl daemon-reload? Why on some systems does it work and others it does not? I see no difference in configuration between the working and non-working systems.
Asked by raines (324 rep)
Dec 9, 2024, 08:59 PM
Last activity: Apr 8, 2025, 01:34 PM