Commit 4bca68ba authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

tcp: don't split packets for restoring a send queue

The kernel can do it better. The problem exists only for recv queues.
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 5ecb7b7c
......@@ -16,7 +16,6 @@ extern int kerndat_get_dirty_track(void);
struct kerndat_s {
dev_t shmem_dev;
int tcp_max_wshare;
int tcp_max_rshare;
int last_cap;
u64 zero_page_pfn;
......
......@@ -19,7 +19,6 @@
#include "util.h"
struct kerndat_s kdat = {
.tcp_max_wshare = 2U << 20,
.tcp_max_rshare = 3U << 20,
};
......@@ -197,7 +196,6 @@ static int tcp_read_sysctl_limits(void)
int ret;
struct sysctl_req req[] = {
{ "net/ipv4/tcp_wmem", &vect[0], CTL_U32A(ARRAY_SIZE(vect[0])) },
{ "net/ipv4/tcp_rmem", &vect[1], CTL_U32A(ARRAY_SIZE(vect[1])) },
{ },
};
......@@ -212,13 +210,12 @@ static int tcp_read_sysctl_limits(void)
goto out;
}
kdat.tcp_max_wshare = min(kdat.tcp_max_wshare, (int)vect[0][2]);
kdat.tcp_max_rshare = min(kdat.tcp_max_rshare, (int)vect[1][2]);
if (kdat.tcp_max_wshare < 128 || kdat.tcp_max_rshare < 128)
if (kdat.tcp_max_rshare < 128)
pr_warn("The memory limits for TCP queues are suspiciously small\n");
out:
pr_debug("TCP queue memory limits are %d:%d\n", kdat.tcp_max_wshare, kdat.tcp_max_rshare);
pr_debug("TCP recv queue memory limit is %d\n", kdat.tcp_max_rshare);
return 0;
}
......
......@@ -456,7 +456,7 @@ static int restore_tcp_seqs(int sk, TcpStreamEntry *tse)
static int __send_tcp_queue(int sk, int queue, u32 len, struct cr_img *img)
{
int ret, err = -1;
int off, max;
int off;
char *buf;
buf = xmalloc(len);
......@@ -466,10 +466,12 @@ static int __send_tcp_queue(int sk, int queue, u32 len, struct cr_img *img)
if (read_img_buf(img, buf, len) < 0)
goto err;
max = (queue == TCP_SEND_QUEUE) ? kdat.tcp_max_wshare : kdat.tcp_max_rshare;
off = 0;
while (len) {
int chunk = (len > max ? max : len);
int chunk = len;
if (queue == TCP_RECV_QUEUE && len > kdat.tcp_max_rshare)
chunk = kdat.tcp_max_rshare;
ret = send(sk, buf + off, chunk, 0);
if (ret <= 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment