From: Jon M. <jon...@er...> - 2019-12-22 02:26:23
|
When a stream socket sends a message larger than TIPC_MAX_USER_MSG_SIZE (66k) it subdivides it into "chunks" of that very size. However, this is not the optimal size, as we have seen that throughput tends to decrease for very large messages. A chunk size of 16k gives a more stable, message size independent throughput. Hence we change this value now. Note however that this value can be changed only for stream sockets, since this the only socket type which can reasseble the chunks without considering message delimitation at the receiving side. Signed-off-by: Jon Maloy <jon...@er...> --- net/tipc/msg.h | 1 + net/tipc/socket.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/net/tipc/msg.h b/net/tipc/msg.h index 6d466eb..e4c13f2 100644 --- a/net/tipc/msg.h +++ b/net/tipc/msg.h @@ -98,6 +98,7 @@ struct plist; #define MAX_H_SIZE 60 /* Largest possible TIPC header size */ #define MAX_MSG_SIZE (MAX_H_SIZE + TIPC_MAX_USER_MSG_SIZE) +#define TIPC_MSG_CHUNK_SIZE 16384 #define FB_MTU 3744 #define TIPC_MEDIA_INFO_OFFSET 5 diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 41688da..884dad5 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -104,6 +104,7 @@ struct tipc_sock { struct list_head cong_links; struct list_head publications; u32 pub_count; + u32 chunk_size; atomic_t dupl_rcvcnt; u16 conn_timeout; bool probe_unacked; @@ -502,6 +503,10 @@ static int tipc_sk_create(struct net *net, struct socket *sock, sk->sk_write_space = tipc_write_space; sk->sk_destruct = tipc_sock_destruct; tsk->conn_timeout = CONN_TIMEOUT_DEFAULT; + if (sock->type == SOCK_STREAM) + tsk->chunk_size = TIPC_MSG_CHUNK_SIZE; + else + tsk->chunk_size = TIPC_MAX_USER_MSG_SIZE; tsk->group_is_open = true; atomic_set(&tsk->dupl_rcvcnt, 0); @@ -1527,7 +1532,7 @@ static int __tipc_sendstream(struct socket *sock, struct msghdr *m, size_t dlen) tipc_sk_connected(sk))); if (unlikely(rc)) break; - send = min_t(size_t, dlen - sent, TIPC_MAX_USER_MSG_SIZE); + send = min_t(size_t, dlen - sent, tsk->chunk_size); blocks = tsk->snd_backlog; if (tsk->oneway++ >= 4 && send <= maxnagle) { rc = tipc_msg_append(hdr, m, send, maxnagle, txq); -- 2.1.4 |