[CRIU] [PATCH] kerndat: tcp_max_rshare -- Shrink default size

Cyrill Gorcunov gorcunov at openvz.org
Sat Sep 5 07:48:37 PDT 2015


In commit 664659a0 we defined max possible
values for TCP queues but on low memory
machines (or on machinese whith custom limits
set via sysctl) this trick doesn't work well
all the time. We have to fetch the allowed values
from /proc/sys/net/ipv4/tcp_[wmem|rmem] which
might be simply missing on the environment
we run.

So lets stick with really small values here
got from kernel source code so instead of failing
we would be able to restore in a bit "slower"
than usual.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---

Andrew, can we somehow run it on our Jenkins instance to test?

 kerndat.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/kerndat.c b/kerndat.c
index 4845532bc0b1..e57c6fd8590d 100644
--- a/kerndat.c
+++ b/kerndat.c
@@ -21,7 +21,23 @@
 #include "lsm.h"
 
 struct kerndat_s kdat = {
-	.tcp_max_rshare = 3U << 20,
+	/*
+	 * TCP send receive buffers are calculated
+	 * dynamically by the kernel taking into account
+	 * the size of memory present on the machine.
+	 *
+	 * On machines with huge amount of memory it grants
+	 * up to 4M for sendding buffer and 6M for receiving.
+	 * But in turn for low mem machines these limits
+	 * are quite small down to 16K for sending and
+	 * 87380 for receiving.
+	 *
+	 * We will find out precise limits in tcp_read_sysctl_limits
+	 * but by default lets stick for small data to not fail
+	 * on restore: better to slowdown restore procedure than
+	 * failing completely.
+	 */
+	.tcp_max_rshare = 87380,
 };
 
 /*
-- 
2.4.3



More information about the CRIU mailing list