]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
tipc: improve message bundling algorithm
authorTuong Lien <tuong.t.lien@dektech.com.au>
Fri, 1 Nov 2019 02:58:57 +0000 (09:58 +0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 4 Nov 2019 01:26:15 +0000 (17:26 -0800)
commit06e7c70c6e8903da57982ab3bdc81e01a8ba941d
tree47ff8b27855c7a002e80592db7d26f07ec6c3395
parent2adf81c0f7b04f9f10e55f5634b1eb7e0a783276
tipc: improve message bundling algorithm

As mentioned in commit e95584a889e1 ("tipc: fix unlimited bundling of
small messages"), the current message bundling algorithm is inefficient
that can generate bundles of only one payload message, that causes
unnecessary overheads for both the sender and receiver.

This commit re-designs the 'tipc_msg_make_bundle()' function (now named
as 'tipc_msg_try_bundle()'), so that when a message comes at the first
place, we will just check & keep a reference to it if the message is
suitable for bundling. The message buffer will be put into the link
backlog queue and processed as normal. Later on, when another one comes
we will make a bundle with the first message if possible and so on...
This way, a bundle if really needed will always consist of at least two
payload messages. Otherwise, we let the first buffer go its way without
any need of bundling, so reduce the overheads to zero.

Moreover, since now we have both the messages in hand, we can even
optimize the 'tipc_msg_bundle()' function, make bundle of a very large
(size ~ MSS) and small messages which is not with the current algorithm
e.g. [1400-byte message] + [10-byte message] (MTU = 1500).

Acked-by: Ying Xue <ying.xue@windreiver.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Tuong Lien <tuong.t.lien@dektech.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/link.c
net/tipc/msg.c
net/tipc/msg.h