platform: increase initial buffer size of libnl's nl_recvmsg() to 32K
Since commit9fafb382db
, 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]cd66af2274/src/libsystemd/sd-netlink/netlink-socket.c (L323)
This commit is contained in:
@@ -6458,7 +6458,7 @@ constructed (GObject *_object)
|
|||||||
/* explicitly set the msg buffer size and disable MSG_PEEK.
|
/* explicitly set the msg buffer size and disable MSG_PEEK.
|
||||||
* If we later encounter NLE_MSG_TRUNC, we will adjust the buffer size. */
|
* If we later encounter NLE_MSG_TRUNC, we will adjust the buffer size. */
|
||||||
nl_socket_disable_msg_peek (priv->nlh);
|
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);
|
g_assert (!nle);
|
||||||
|
|
||||||
nle = nl_socket_add_memberships (priv->nlh,
|
nle = nl_socket_add_memberships (priv->nlh,
|
||||||
|
Reference in New Issue
Block a user