4

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?

2
  • 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, 2014 at 10:21
  • @Wieland I don't have this file. As the doc says, it's only present when swap is accounted. Jul 29, 2014 at 10:37

2 Answers 2

2

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.

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

Also you can edit

/etc/default/grub

and replace the line

GRUB_CMDLINE_LINUX=""

by

GRUB_CMDLINE_LINUX="swapaccount=1"

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

You must log in to answer this question.

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