Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 25 down vote accepted

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

share|improve this answer
1  
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 at 13:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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