I read this question and tried the methods suggested. I edited \etc\cgconfig.conf like this:

group memlimit {
    memory {
       memory.limit_in_bytes = 21474836480;

and /etc/cgrules.conf

user1   memory   memlimit/

but it does not work.

Using /etc/security/limits.conf abort the process with larger than memory threshold. I just want the process alive and send it to swap. I am using Ubuntu, 18.04LTS OS. I already installed apt install cgroup-tools. Here suggest to use GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1" and update grub. Is it safe to update grub?

1 Answer 1


Yes, this is safe to update the grub with theses options. In fact, the kernel parameters you add, enable the cgroups to manage memory limits and the swap.

If you already installed docker, if you don't add theses options, you'll have warnings. It is also written on docker post-install documentation at the end of the page. On other distro, there was no need of theses options because they are enabled by default.

So to come back to your problem, yes theses kernel parameters may solve your problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .