Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Vagin <avagin@openvz.org>2015-09-04 15:30:00 +0300
committerPavel Emelyanov <xemul@parallels.com>2015-09-04 18:26:51 +0300
commit50d4d073670582e4caba56e6a6b632e593730df9 (patch)
treea5f2630ea1c382ace746c947eea1d61c54000f1e
parent675a84fbc93305bc61f5cd811239eb5e5c9477ec (diff)
netlink: increase the receive buffer size
Currently the buffer size is 4096. It always works because we use hosts where PAGE_SIZE is 4096. PowerPC64 has a bigger PAGE_SIZE. Here is a comment from the kernel code. /* * skb should fit one page. This choice is good for headerless malloc. * But we should limit to 8K so that userspace does not have to * use enormous buffer sizes on recvmsg() calls just to avoid * MSG_TRUNC when PAGE_SIZE is very large. */ We set the buffer size to 16384, because it's the max length of recvmsg() for this case. We will need less iterations to collect all data, so the perfomance should be better. Signed-off-by: Andrey Vagin <avagin@openvz.org> Cc: Laurent Dufour <ldufour@linux.vnet.ibm.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
-rw-r--r--libnetlink.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libnetlink.c b/libnetlink.c
index 84ee6eb2b..49c804fd7 100644
--- a/libnetlink.c
+++ b/libnetlink.c
@@ -73,7 +73,7 @@ int do_rtnl_req(int nl, void *req, int size,
struct msghdr msg;
struct sockaddr_nl nladdr;
struct iovec iov;
- static char buf[4096];
+ static char buf[16384];
int err;
if (!error_callback)
@@ -121,6 +121,12 @@ int do_rtnl_req(int nl, void *req, int size,
if (err == 0)
break;
+ if (msg.msg_flags & MSG_TRUNC) {
+ pr_err("Message truncated\n");
+ err = -EMSGSIZE;
+ goto err;
+ }
+
err = nlmsg_receive(buf, err, receive_callback, error_callback, arg);
if (err < 0)
goto err;