/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.


You can configure swappiness per cgroup:



For an easier introduction to cgroups, with examples, see


  • 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.