On my Archlinux box I want to limit some applications to a smaller amount of memory using cgroups. Since I use swap, I need to account memory+swap. How can I enable swap accounting?

  • From the document you linked to: memory.memsw.limit_in_bytes # set/show limit of memory+Swap usage - does this not work for you? – Wieland Jul 29 '14 at 10:21
  • @Wieland I don't have this file. As the doc says, it's only present when swap is accounted. – Eugene Yarmash Jul 29 '14 at 10:37

Arch Linux' kernel has the swap accounting disabled by default (cf. the kernel config file). You can enable it by booting with swapaccount=1 in your kernel cmdline (cf. the kernels Kconfig documentation.

  • Since it's disabled by default, I wonder what the downsides are? – lucidbrot Dec 20 '20 at 20:42

Also you can edit


and replace the line




Then run update-grub [optional], and reboot the server.

find more tricks in http://kencochrane.net/blog/2013/08/the-docker-guidebook/#remove-all-docker-images

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.