[Devel] [PATCH RHEL7 COMMIT] mm, fs: make vfs_cache_min_ratio=0 by default
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Oct 12 12:57:45 MSK 2017
The commit is pushed to "branch-rh7-3.10.0-693.1.1.vz7.37.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.1.1.vz7.37.12
------>
commit 592e27fa3be43f9a54b1d24751da764dc332591e
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date: Thu Oct 12 12:57:45 2017 +0300
mm,fs: make vfs_cache_min_ratio=0 by default
vfs_cache_min_ratio is a sysctl ported from PCS6. It is 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 2cb018a..ce8e24f 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);
More information about the Devel
mailing list