Re: FIREFOX is killing the whole PC Part III
On 23.11.2022 17:09, Schwibinger Michael wrote: > Good afternoon > > I saw cgroups. > > Thank You. > > But I cant understand. > > Is it a concept to limit all tasks? You can limit all, a single one or (the name suggests this one) a group of processes. There are plenty of system resources which can be configured. > Where can I find a introduction? I don't know either. But maybe this one is fine to start with: https://www.redhat.com/sysadmin/cgroups-part-one Some examples limiting Firefox to 500 MB of RAM and low CPU resources, do as root: # cd into the cgroup filesystem, defaults to cgroup2 on Debian Bullseye, others may vary cd /sys/fs/cgroup/ # create a new cgroup mkdir ffox # cd into the cgroup dir cd ffox/ # add all firefox-esr processes to the cgroup, all newly created subprocesses will automatically get added to ffox cgroup for i in $(pidof firefox-esr); do echo $i > cgroup.procs ; done # limit memory usage to 500 MB echo 500M > memory.high # limit cpu usage to less wight (defaults to 100) echo 10 > cpu.weight # also limit swap memory because else it will fill swap after the memory limit kicks in echo 100M > memory.swap.max ... now watch Firefox stall if other processes either use CPU resources or Firefox tries to consume more than 600 MB of Memory (which is small nowadays for multiple tabs; but mind, if Firefox already has more memory allocated it will keep this). Typically you can use some more friendly userspace interface. But don't think of using cgroup-tools with Debian Bullseye: Version 0.41 in Bullseyes repository supports cgroups V1 only while Bullseyes Kernel defaults to V2. There's plenty of help you can find with your favourite Internet search engine. regards hede PS: to remove Firefox from the ffox cgroup either restart Firefox or: cd /sys/fs/cgroup/ffox/ && for i in $(cat cgroup.procs); do echo $i > ../cgroup.procs ; done
Re: FIREFOX is killing the whole PC Part III
Am 20.11.2022 um 12:06 schrieb Schwibinger Michael: > > 2 Questions: > > What does it do? The script, that you included, seems to search for a couple of browser processes to limit their usage of CPU resources. I do not think, this would be such a great idea. In order to avoid, that a browser changes your system in any way, you could do, what i do: I did locate the places, the browser uses (not just as cache, but also for storing defaults, history, and such). Then i use a tmpfs to create an overlay filesystem and allow the browser to change those filesystems only temporarily. works as intended, but created problems, if you WANT to change something (like f.i. download a file). But this method is a bit difficult to implement for someone, who is incomfortable with commandline and scripts.