Talk:OpenRC/CGroups

From Gentoo Wiki
Jump to:navigation Jump to:search
Note
Before creating a discussion or leaving a comment, please read about using talk pages. To create a new discussion, click here. Comments on an existing discussion should be signed using ~~~~:
A comment [[User:Larry|Larry]] 13:52, 13 May 2024 (UTC)
: A reply [[User:Sally|Sally]] 17:26, 3 December 2024 (UTC)
:: Your reply ~~~~

Example: limit memory and I/O for cron jobs

Running rsnapshot could use up a large amount of the system's pagecache, which can cause significant latencies for regular operations like launching new processes / allocating memory (as shown by sys-process/latencytop). To limit the impact of such background jobs on system latency you can limit the amount of memory used by all cron jobs: including the memory used for the file system cache.

https://github.com/Feh/nocache#alternate-approaches shows how to this can be done from the backup script itself.

However using OpenRC you can automatically apply this to all jobs launched from cron. Here is an example if you are using sys-process/cronie:

FILE /etc/conf.d/cronieLimit memory and I/O used by cron jobs
# Settings for the CRON daemon.
# CRONDARGS= :  any extra command-line startup arguments for crond
CRONDARGS=
rc_cgroup_memory="memory.limit_in_bytes 512M"
rc_cgroup_blkio="blkio.weight 100"

# if you want to kill all running cron jobs when stopping or restarting the cron daemon
# then uncomment the follow line
# rc_cgroup_cleanup="yes"
root #service cronie restart

To check that it worked:

root #cat /sys/fs/cgroup/memory/openrc_cronie/memory.limit_in_bytes
root #cat /sys/fs/cgroup/memory/openrc_cronie/tasks; pidof crond

--Edwintorok (talk) 12:24, 9 October 2016 (UTC)

CGroups version 2 and enabled controllers by default?

How does OpenRC enable cgroups version 2? On my Gentoo, the file /sys/fs/cgroup/cgroup.subtree_control is empty. This means that no services have any enabled controllers.

To enable a controller simply do:

root #echo "+cpu +memory" > /sys/fs/cgroup/cgroup.subtree_control

To enable them by default set the following line in rc.conf.

FILE /etc/rc.confEnable CGroups v2 controllers by default
rc_cgroup_controllers="cpu memory io pids"


--Gatak (talk) 10:24, 9 November 2018 (UTC+1)

Wrong URI in References section

Talk status
This discussion is still ongoing.

https://www.kernel.org/doc/html/v5.14-rc1/admin-guide/cgroup-v2.html should be https://www.kernel.org/doc/html/v5.14/admin-guide/cgroup-v2.html

When I try to edit the page or that section, something is going wrong and I cannot make that change. --DominiqueMichel (talk) 10:57, 26 February 2024 (UTC)

When I click on Edit source, I just see that: == References == <references /> [[Category:OpenRC]] and don't know what to do.

If I click on edit, I get a popup with: Error contacting the Parsoid/ RESTBase server (HTTP 500) --DominiqueMichel (talk) 11:08, 26 February 2024 (UTC)

fixed it, thank you! (the link had to be changed in === CGroups version 2 === because it is referenced there for the first time)
--Tastytea (talk) 11:17, 26 February 2024 (UTC)