Matt Jolly wrote:
> Hi,
>
> Cgroups are the answer. If you're on systemd you could try making a
> `slice` for Firefox that might look a bit like this:
>
> /etc/systemd/system/user-firefox.slice
>
> ```
> [Unit]
> Description=Firefox Slice
> Before=slices.target
>
> [Slice]
> MemoryAccounting=true
> MemoryLimit=512M
> ```
>
> Then you can run 
>
> ```
> systemctl daemon-reload && systemctl restart user-firefox.slice
> ```
>
> Then launch Firefox in the slice like so
>
> ```
> systemd-run -q --user --scope --unit ff \
>   --slice user-firefox -- firefox --profile myprofile
> ```
>
> Which will apply the limits in the slice (check the docs, there's all
> sorts) to anything running within it. You can enable the slice and run
> Firefox (or anything else you want to limit, really).
>
> You may need to adapt these commands a little, I wrote this on mobile. :)
>
> I use slices on HPC to limit users from monopolising interactive
> nodes, and our batch jobs kill anything that exceeds requested memory
> (hope that wasn't 100h into a job!). I do this on login with user
> slices but the concept is the same.
>
> Here's the docs on slice/scope settings:
> https://www.freedesktop.org/software/systemd/man/latest/systemd.resource-control.html#
>
> You could also try something like this:
> https://github.com/mk-fg/fgtk#cgrc
>
> You can directly do cgroups on openrc... Probably? I've never had to
> worry about it.
>
> Cheers,
>
> Matt
>

I still use openrc.  I'll look around and see what I can find.  Now I
know what to look for.  Thing is, not sure I use cgroups either, unless
it is on by default.   o_O

Dale

:-)  :-) 

Reply via email to