The behavior of vm.swappiness was always a bit confusing for novice linux users, as setting vm.swappiness to 0 would not completely disable swapping in the system during a memory crunch. vm.swappiness would only affect the agressiveness of swapping.
Following upstream commit tried to give more control to parameter. This commit tried to avoid swapping completely when vm.swappiness is set to 0.
commit fe35004fbf9eaf67482b074a2e032abb9c89b1dd
Author: Satoru Moriya
Date: Tue May 29 15:06:47 2012 -0700
mm: avoid swapping out with swappiness==0
With above commit, setting vm.swappiness to “0” instructs the
kernel not to initiate swapping until the amount of free and
file-backed pages is less than the high water mark in a memory
zone. In other words, it tries to reclaim as much memory that can
be reclaimed, before swapping starts.
This greatly reduced the chances of swapping.
When this …
[Read more]