28

/proc/sys/vm/swappiness is nice, but I want a knob that is per process like /proc/$PID/oom_adj. So that I can make certain processes less likely than others to have any of their pages swapped out. Unlike memlock(), this doesn't prevent a program from being swapped out. And like nice, the user by default can't make their programs less likely, but only more likely to get swapped. I think I had to call this /proc/$PID/swappiness_adj.

29

You can configure swappiness per cgroup:

http://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt

http://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt

For an easier introduction to cgroups, with examples, see

https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Resource_Management_Guide/ch01.html

  • 2
    Beware, that, according to the RedHat guide, enabling memory-cgroup uses additional memory, 40 byte per page. Consider hugepages to reduce the number of pages in this context, see wiki.debian.org/Hugepages – Tino Apr 9 '16 at 13:35

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.