On Tue, 30 Apr 2019 15:03:27 +0000 Dmitry Bogatov <[email protected]> wrote: > > [2019-02-28 12:06] Dmitry Bogatov <[email protected]> > > Package: runit > > Version: 2.1.2-23 > > Severity: wishlist > > > > Just a thought. What about adding support of cgroups into invoke-run > > script.
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. > > It could create one cgroup for every service and set > > configure its limits from config directory > > /etc/sv/<service>/cf-conf, for example. we are using a cgroup directory inside the service directory; 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 > > 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? > -- > Note, that I send and fetch email in batch, once every 24 > hours. If matter is urgent, try https://t.me/kaction > > -- > >

