#923449 runit: cgroups support

Package:
runit
Source:
runit
Description:
system-wide service supervision
Submitter:
Dmitry Bogatov
Date:
2026-08-21 22:47:02 UTC
Severity:
wishlist
Tags:
#923449#5
Date:
2019-02-28 12:06:13 UTC
From:
To:
Just a thought. What about adding support of cgroups into invoke-run
script. It could create one cgroup for every service and set configure
its limits from config directory /etc/sv/<service>/cf-conf, for example.

#923449#10
Date:
2019-04-30 15:03:27 UTC
From:
To:
[2019-02-28 12:06] Dmitry Bogatov <KAction@debian.org>

Some experiments had shown following wierd behaviour:

1. create new cgroup without any limits

 # mkdir /sys/fs/cgroups/foobar
 # cd /sys/fs/cgroups/foobar

2. try to put process it it

 # echo $$ > tasks
 bash: echo: write error: No space left on device

3. Now, perform magic I have searched for on web for hour or so:

 # echo 0 | tee cpuset.mems cpuset.cpus
 # echo $$ > tasks

4. Success!

This is workaround I need to keep in mind when implementing cgroup support.

Dear kernel maintainers, is intendend behaviour?

#923449#15
Date:
2026-08-21 22:39:53 UTC
From:
To:
there is a commit in git (next branch) that adds optional support for
cgroup in invoke-run and finish-exec;
cgroup2 is mounted in stage 1 for runit-init.
when the 'cgroup' directory is found and the process is run with
uid=0 then files inside cgroup are copied into
/sys/fs/cgroup/service/svname/ and svname pid is added to the
svname cgroup;
finish-exec, under the same condition of invoke-run (cgroup dir and
uid=0) simply kills every process in the cgroup and then removes it

This needs testing; still TODO: manpage update for invoke-run and
runsv-cg; briefly documenting files inside cgroup would be nice too

#923449#18
Date:
2026-08-21 22:44:16 UTC
From:
To:
Hello,

Bug #923449 in runit reported by you has been fixed in the
Git repository and is awaiting an upload. You can see the commit
message below and you can check the diff of the fix at:

https://salsa.debian.org/debian/runit/-/commit/48450cdc85438c77ee6b830834d9f7b31f4cb534
------------------------------------------------------------------------
invoke-run, finish-exec: add optional cgroup support

* invoke-run:
  when 'cgroup' directory is found in the service directory and uid=0
  run 'runsv-cg create'.
  this will create /sys/fs/cgroup/service/svname directory, then it
  will copy files in cgroup directory to /sys/fs/cgroup/service/svname/
  and finally will add the service pid to
  /sys/fs/cgroup/service/"$sv"/cgroup.procs
* finish-exec:
  when 'cgroup' directory is found in the service directory and uid=0
  run 'runsv-cg destroy'.
  this will kill every process in the cgroup, then it will remove
  the svname cgroup in /sys/fs/cgroup/service/svname.
  For well behaving services, 'runsv-cg remove' could be enough.

Closes: #923449
------------------------------------------------------------------------

(this message was generated automatically)
-- 
Greetings

https://bugs.debian.org/923449