diff options
author | Thomas Haller <thaller@redhat.com> | 2016-12-02 14:57:23 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-12-02 15:23:11 +0100 |
commit | ed82b6bcb349d96fb5eecc44ca3c8f93a3c63cfd (patch) | |
tree | 99ce2d7ffac671e2a1beb05273d181d64b432f0d | |
parent | d29839c43091d855ae564284bda396724558a7f7 (diff) | |
download | NetworkManager-ed82b6bcb349d96fb5eecc44ca3c8f93a3c63cfd.tar.gz |
platform: increase initial buffer size of libnl's nl_recvmsg() to 32K
Since commit 9fafb382db273160a5e9e10ff84f8a4d2af220d3, we would
explicitly set libnl's socket buffer size to 4*getpagesize().
That is also the default of libnl itself. Additionally, we would
workaround too small buffers by increasing the buffer size up to 512K.
A too small buffer causes messages to be lost. Usually, that only
results in a cache-resync, which isn't too bad. Lost messages are however
a problem if the lost message was an ACK that we were waiting for.
However, it is rather unlikely to happen, because it's expected that
the buffer size gets adjusted already when the cache is filled initially,
before any other requests are pending.
Still, let's increase the default buffer size to 32K, hoping that this
initial value is already large enough to avoid the problem altogether.
Note that iproute2 also uses a buffer size of 32K [1] [2].
Alternatively, we could use MSG_PEEK like systemd does [3]. However,
that requires two syscalls per message.
[1] https://patchwork.ozlabs.org/patch/592178/
[2] https://git.kernel.org/cgit/linux/kernel/git/shemminger/iproute2.git/tree/lib/libnetlink.c?id=f5f760b81250630da23a4021c30e802695be79d2#n274
[3] https://github.com/systemd/systemd/blob/cd66af227416eb7b9f150b92abff4e4a3e92253b/src/libsystemd/sd-netlink/netlink-socket.c#L323
-rw-r--r-- | src/platform/nm-linux-platform.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index c2404e13c4..ab2ab9b017 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -6458,7 +6458,7 @@ constructed (GObject *_object) /* explicitly set the msg buffer size and disable MSG_PEEK. * If we later encounter NLE_MSG_TRUNC, we will adjust the buffer size. */ nl_socket_disable_msg_peek (priv->nlh); - nle = nl_socket_set_msg_buf_size (priv->nlh, 4 * getpagesize ()); + nle = nl_socket_set_msg_buf_size (priv->nlh, 32 * 1024); g_assert (!nle); nle = nl_socket_add_memberships (priv->nlh, |