Re: cgroupv2 Reply #15 – 21 November 2019, 15:57:21 It's simpler in practice than reading about it (although I am using v1 cgroups, I think v2 just has a bit different layout or something) - look in /sys/fs/cgroups, there are directories with files that set limits, and files that can contain the pid number of processes. Subdirs are limited by the parent limits plus the limits defined in their own files. The manager programs change the values in the files and create the directories (you can even do this manually if you know what to do.) So if you configure a manager to set up a 50% CPU directory and put a process in it then it uses 50% of one core until you take it out again. You can limit other resources likewise.
Re: cgroupv2 Reply #16 – 08 January 2020, 00:09:26 Quote from: ####### – on 28 October 2019, 20:23:30I use libcgroup-openrc-git. It's a fully working package but I didn't know what I could do with it other than use it myself, as it's an openrc Artix package so might not be suitable for the AUR, especially as I don't have a straight Arch install to test it with, and Artix package guidelines say no git packages.The patch came from their mailing list, they were very helpful. AFAIK (which may not be that far ) it's the best most full featured cgroup manager, and it's not had a release for a few years as cgroup management functionality has been added to systemd leaving other methods as a low priority I suppose. But a lot of useful commits have been added since the last release, so the git version should be better.Had you also noticed ionice has been broken due to kernel changes? This also breaks btrfs scrub niceness. The recommendation is to use cgroups instead.Here's the PKGBUILD and associated files (it provides / conflicts with the libcgroup AUR pkg so it won't cause a problem if you had that installed before):Code: [Select]$ cat PKGBUILD pkgname=libcgroup-openrc-gitpkgver=r920.62f7665pkgrel=1pkgdesc='Library that abstracts the control group file system in Linux, configured for OpenRC, GIT version.'arch=('i686' 'x86_64')url='http://libcg.sourceforge.net'license=(LGPL)makedepends=('git')provides=('libcgroup')conflicts=('libcgroup')backup=('etc/cgconfig.conf' 'etc/cgrules.conf' 'etc/cgsnapshot_blacklist.conf')options=('!libtool')install=libcgroup.installsource=("git://git.code.sf.net/p/libcg/libcg" "fix-segfault.patch" "libcgroup")md5sums=('SKIP' 'SKIP' 'SKIP')pkgver() { cd "$srcdir/libcg" printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"}prepare() { cd ${srcdir}/libcg patch --forward --strip=1 --input="${srcdir}/fix-segfault.patch"#patch --forward --strip=1 --input="fix-segfault.patch"}build() { cd "${srcdir}/libcg" autoreconf -i ./configure \ --prefix=/usr \ --sysconfdir=/etc \ --localstatedir=/var \ --sbindir=/usr/bin \ --enable-opaque-hierarchy=name=openrc make}package() { cd "${srcdir}/libcg" make DESTDIR="${pkgdir}" pkgconfigdir="/usr/lib/pkgconfig" install install -D -m0644 samples/cgconfig.conf "${pkgdir}/etc/cgconfig.conf" install -D -m0644 samples/cgrules.conf "${pkgdir}/etc/cgrules.conf" install -D -m0644 samples/cgsnapshot_blacklist.conf "${pkgdir}/etc/cgsnapshot_blacklist.conf" install -D -m0755 ${srcdir}/libcgroup "${pkgdir}/etc/init.d/libcgroup" install -d -m0755 $pkgdir/etc/cgconfig.d rm -f ${pkgdir}/usr/lib/security/pam_cgroup.{la,so,so.0} mv ${pkgdir}/usr/lib/security/pam_cgroup.so.0.0.0 ${pkgdir}/usr/lib/security/pam_cgroup.so rm -rf ${pkgdir}/etc/rc.d # Make cgexec setgid cgred chown root:160 ${pkgdir}/usr/bin/cgexec chmod 2755 ${pkgdir}/usr/bin/cgexec #mkdir -p $pkgdir/etc/cgconfig.d}$ cat fix-segfault.patch diff --git a/src/parse.y b/src/parse.yindex 98f7699..e67ad54 100644--- a/src/parse.y+++ b/src/parse.y@@ -45,9 +45,9 @@ int yywrap(void) int val; struct cgroup_dictionary *values; }-%type <name> ID DEFAULT+%type <name> ID DEFAULT group_name %type <val> mountvalue_conf mount task_namevalue_conf admin_namevalue_conf-%type <val> admin_conf task_conf task_or_admin group_conf group start group_name+%type <val> admin_conf task_conf task_or_admin group_conf group start %type <val> namespace namespace_conf default default_conf %type <values> namevalue_conf %type <val> template template_conf$ cat libcgroup#!/usr/bin/openrc-runname="libcgroup"description="libcgroup daemon - cgrulesengd"command="/usr/bin/cgrulesengd"command_args="-s -g cgred"start_pre() { /usr/bin/cgconfigparser -l /etc/cgconfig.conf -s 1664 }stop_post() { /usr/bin/cgclear -l /etc/cgconfig.conf -e }$ cat libcgroup.install post_install() { getent group cgred &>/dev/null || groupadd -r -g 160 cgred >/dev/null}post_upgrade() { post_install}post_remove() { getent group cgred &>/dev/null && groupdel cgred >/dev/null}Hi! maybe offtopic but: where i can find the source?duh now I see. You override https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=libcgroup right? Last Edit: 08 January 2020, 00:23:58 by Glats 1 Likes
Re: cgroupv2 Reply #17 – 09 January 2020, 02:57:00 No, on topic, as it's moved!I think this is now the main repo, I will look at it more carefully in due course.https://github.com/libcgroupAlso the patch should soon no longer be required, as it has been committed to drakenclimber's fork:https://sourceforge.net/p/libcg/mailman/message/36895363/ Last Edit: 09 January 2020, 03:28:42 by #######
Re: cgroupv2 Reply #18 – 29 January 2020, 20:49:17 In the end i created my own implementationhttps://github.com/glats/libcgroup-openrcHere it is for anyone want to use it. Last Edit: 31 January 2020, 15:12:17 by Glats