In the question Limit memory usage for a single Linux process it was mentioned to change the file /etc/default/grub so that GRUB_CMDLINE_LINUX_DEFAULT contains

GRUB_CMDLINE_LINUX_DEFAULT="cgroup_enable=memory swapaccount=1"

What does swapaccount=1 do? Is there any risk or drawback in applying that?


Apparently it is/was used to enable swap accounting, i.e. it tells the kernel to monitor and restrict swap usage per control groups (cgroups for short). RedHat seems to have started enabling it by default in RHEL7, so apparently the drawbacks are minimal.

You should check your kernel configuration (typically /boot/config-<kernel_version>). If it includes the line:


then the potential to track swap usage by cgroups exists, and the swapaccount= boot option is available. Any actual restriction only takes effect if a cgroup with a swap limit is created, and a process is moved into that cgroup.

If it also includes the line:


then swapaccount=1 is enabled by default, and you would need to use an explicit swapaccount=0 boot option to disable it if desired.

systemd and Docker will use cgroups extensively as part of their normal functionality.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.