SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I would like to ask for some testing, since now the cool thing I have bodged only works 'on my machine', but I think that it may be found useful by more people.
I was frustrated by the fact that my system is not optimised for responsiveness, and that some misbehaving applications may, for example, occupy all the cpu and render the system unusable, or occupy too much swap, and make the system unable to hibernate. So I decided to use libcgroup (as it is included in the stock Slackware) to control the misbehaving applications.
What is it ?
It is one main rc.d script, and a few application lists, generated on stock Slackware-current, which configure several restriction groups which don't allow applications to misbehave.
What are the 'groups'?
Root group: the total memory is limited to the amount of swap. This way everything fits into the swap when hibernation is neede.
System group: Always has at least one core (or half of a core on a 1-core machine) available for itself.
GUI group: Always have more than one core available for itself, and never swaps.
Multimedia group: Always has a bit of cpu available (so that music keeps playing) and is limited to 90% cpu max, to constrain misbehaviour.
Restricted group: Has its memory limited to half of the system memory. (And unlimited swap.) I put browsers in this group, as they are the most likely to misbehave.
The secret Skype group: The most restricted one.
The parameters are mostly tunable in /etc/rc.d/rc.lwf_userfriendly_cgroup.conf , or in the lists in /etc/cgconfig.templates/ and /etc/cgrules.templates/
Please, don't edit the .conf files directly, as they are dynamically generated with bash and awk.
The script starts for ~1 minute, but this is due to extra care when pgreping.
If anyone wants a much-much faster version, I could do it.
The rules are enforced by cgrulesengd, and you can run a default one, or rely on the script having it's own one.
Any feedback welcome, please, test, I really need it.
Now the full list of files written in /etc/ is in the top of the rc.lwf_userfriendly_cgroup, so you can check what it mutates when runs.
Added installation instructions for those who don't use Slackware or want to install the script manually.
The SlackBuild is also updated.
Any feedback would be welcomed, especially other tricks for responsiveness optimisation.
(I am thinking about a perbash-cgroup trick, but that on I already know.)
And why we will want this systemd-ish feature in Slackware?
1) It's not systemd-ish. libcgroup is many years older than systemd
2) not sure about you, but on my machine Firefox (and some other apps) has a tendency to sometimes put the whole system in a knee-chest position by stealing all the cpu, memory and IO. I don't like this, I like my foxen caged.
What the heck. I'll take the plunge. I've never done any experimenting with cgroups, beyond a single introduction explaining how to use them. Maybe this will motivate me to do some research.
Root group: the total memory is limited to the amount of swap. This way everything fits into the swap when hibernation is neede.
My main box have 16GB DDR3 RAM, and with my usage habits, I will have to put efforts to consume barely 8GB, that's why I chosen to not use a real SWAP partition, but a 1GB ZRAM (compressed memory) device, just to give a chance to kernel to defragment the memory.
So, according with your wise vision, the root shall use in that box only 1GB from 16GB available, even there are no chances for it to hibernate ever?
No offense, but that's ridiculous.
Last edited by ZhaoLin1457; 06-23-2019 at 01:29 AM.
My main box have 16GB DDR3 RAM, and with my usage habits, I will have to put efforts to consume barely 8GB, that's why I chosen to not use a real SWAP partition, but a 1GB ZRAM (compressed memory) device, just to give a chance to kernel to defragment the memory.
So, according with your wise vision, the root shall use in that box only 1GB from 16GB available, even there are no chances for it to hibernate ever?
No offense, but that's ridiculous.
Well, you're not forced to use this feature. Just turn it off if your only want to restrict firefox.
This seems to be a huge problem. V1 (the version used now) are much worse...
But the only userspace code I have found to support cgroups-v2 is in systemd.
It may be possible to rip the code related to cgroupsv2 from systemd into an independent library, but I am not sure it is an easy thing to do, and would take me a lot of time. Not good.
If anyone is aware of tools for working with cgroups-v2 without systemd, I'd be very interested.
No offense, but someone warned you already that you are playing with a thing which is (today) part of systemd, at least as user-space side, as it seems...
No offense, but someone warned you already that you are playing with a thing which is (today) part of systemd, at least as user-space side, as it seems...
No offence, but _everything_ is now a thing which is (today) part of systemd. There is systemd-bootlogd, systemd-bootd, systemd-loggerd, systemd-nspawn, systemd-cgroups, systemd-virtd, systemd-networkd, systemd-udev, systemd-consoled, and * knows what.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.