[rh7] mm,fs: make vfs_cache_min_ratio=0 by default

Submitted by Andrey Ryabinin on Oct. 9, 2017, 2:20 p.m.


Message ID 20171009142017.6288-1-aryabinin@virtuozzo.com
State New
Series "mm,fs: make vfs_cache_min_ratio=0 by default"
Headers show

Commit Message

Andrey Ryabinin Oct. 9, 2017, 2:20 p.m.
vfs_cache_min_ratio is a sysctl ported from PSBM-6. It supposed
to increase performance, but it was noticed to do the opposite

It supposed to protect slabs from reclaiming if their percentage is lower
than the sysctl value (2% by default).
However, it's not quite clear in what scenario it supposed to improve
performance. Moreover, I don't quite understand how is this 2% protection
supposed to change anything in reclaim logic. If we have relatively
small number of reclaimable slab objects  they won't be reclaimed anyway
because of priority protection. The following simple test:

	mkdir -p /vz/tst/
	mkdir -p /sys/fs/cgroup/memory/tst

	for i in {1..4} ; do
		mkdir -p /sys/fs/cgroup/memory/tst/test$i
		# 1G
		echo $((1024*1024*1024)) > /sys/fs/cgroup/memory/tst/test$i/memory.limit_in_bytes
		echo $$ > /sys/fs/cgroup/memory/tst/test$i/tasks
		mkdir -p /vz/tst/test$i

		#fill slab_reclaimable
		stat /vz/tst/test$i > /dev/null
		for j in {1..10065} ; do
			mkdir -p /vz/tst/test$i/test$j
			stat /vz/tst/test$i/test$j > /dev/null

		#read 1G file to fill page cache in memcg.
		cat /vz/test$i > /dev/null

	cat /sys/fs/cgroup/memory/tst/memory.stat
	echo $$ > /sys/fs/cgroup/memory/tasks

	#create memory pressure, sizeof /vz/fill_ram
	#should be bigger than total ram.
	cat /vz/fill_ram > /dev/null

show that there is no much difference between 0 and 2% settings.
In both cases we prefer to reclaim page cache.

So let's set vfs_cache_min_ratio to 0 and see how it goes.

Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
 fs/dcache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/fs/dcache.c b/fs/dcache.c
index 2cb018a05078..ce8e24f22f9a 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -86,7 +86,7 @@ 
 int sysctl_vfs_cache_pressure __read_mostly = 100;
-int sysctl_vfs_cache_min_ratio __read_mostly = 2;
+int sysctl_vfs_cache_min_ratio __read_mostly = 0;
 __cacheline_aligned_in_smp DEFINE_SEQLOCK(rename_lock);