[CRIU] [PATCH] inet: tcp -- Find size of max write memory allowed to restore TCP data

Cyrill Gorcunov gorcunov at gmail.com
Mon Oct 7 06:22:09 PDT 2013


On Mon, Oct 07, 2013 at 05:11:50PM +0400, Pavel Emelyanov wrote:
> On 10/07/2013 03:49 PM, Cyrill Gorcunov wrote:
> > The maximal size which may be used in the kernel for sending TCP data
> > on restore is varies depending on how many memory installed on the
> > system, moreover the memory allocated for "read queue" is bigger than
> > used for "write queue". Thus when we checkpointed a big slab of data
> > we need to figure out which size is allowed for sending data on restore.
> > 
> > For this we read /proc/sys/net/ipv4/tcp_wmem on restore and calculate
> > the size needed, then we simply chop data to segements and send it
> > in a loop.
> > 
> > Typical output on restore is something like
> > 
> >  | (00.012001)  17471: TCP write queue memory limit is 2097152
> > 
> > https://bugzilla.openvz.org/show_bug.cgi?id=2751
> > 
> > Reported-by: Andrey Vagin <avagin at openvz.org>
> > Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> > ---
> > +
> > +int tcp_read_sysctl_limits(void)
> > +{
> > +	const char path[] = "/proc/sys/net/ipv4/tcp_wmem";
> > +	int fd, n, limit = max_wshare;
> > +	int vect[3] = { };
> > +	char buf[512];
> > +
> > +	/*
> > +	 * Lets figure out which exactly amount of memory is
> > +	 * availabe for sending data on restore. If for some
> > +	 * reason we fail -- just setup 1M wich is small enough
> > +	 * to proceed without errors.
> > +	 */
> > +	fd = open("/proc/sys/net/ipv4/tcp_wmem", O_RDONLY);
> 
> There's sysctl engine for reading sysctls.
> Other than this -- the read queue restore would require other sysctl read, won't it?

Yeah, I'll check the sysctl engine code, thanks! As to read queue -- I think yes,
you're right, I'll update, thanks!


More information about the CRIU mailing list