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

Andrey Ryabinin aryabinin at virtuozzo.com
Mon Oct 9 17:20:17 MSK 2017


vfs_cache_min_ratio is a sysctl ported from PSBM-6. It supposed
to increase performance, but it was noticed to do the opposite
https://jira.sw.ru/browse/PSBM-68644.

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:

	#!/bin/bash
	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
		done

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

	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.

https://jira.sw.ru/browse/PSBM-69672
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 fs/dcache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
 EXPORT_SYMBOL_GPL(sysctl_vfs_cache_pressure);
 
-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);
 
-- 
2.13.6



More information about the Devel mailing list