summaryrefslogtreecommitdiffstats
path: root/net/vmw_vsock
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2019-09-03 03:38:16 -0400
committerDavid S. Miller <davem@davemloft.net>2019-09-05 09:53:01 +0200
commitf4d7c8e3da9173ac7b0498abc3aab0d320efe997 (patch)
treefaa189cc53c654723d6f0f57ce7c8c598314036f /net/vmw_vsock
parent9c895c1bc576f1091a685f62595dc520659863df (diff)
downloadlinux-f4d7c8e3da9173ac7b0498abc3aab0d320efe997.tar.gz
linux-f4d7c8e3da9173ac7b0498abc3aab0d320efe997.tar.bz2
linux-f4d7c8e3da9173ac7b0498abc3aab0d320efe997.zip
vsock/virtio: a better comment on credit update
The comment we have is just repeating what the code does. Include the *reason* for the condition instead. Cc: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/vmw_vsock')
-rw-r--r--net/vmw_vsock/virtio_transport_common.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
index 94cc0fa3e848..5bb70c692b1e 100644
--- a/net/vmw_vsock/virtio_transport_common.c
+++ b/net/vmw_vsock/virtio_transport_common.c
@@ -307,8 +307,13 @@ virtio_transport_stream_do_dequeue(struct vsock_sock *vsk,
spin_unlock_bh(&vvs->rx_lock);
- /* We send a credit update only when the space available seen
- * by the transmitter is less than VIRTIO_VSOCK_MAX_PKT_BUF_SIZE
+ /* To reduce the number of credit update messages,
+ * don't update credits as long as lots of space is available.
+ * Note: the limit chosen here is arbitrary. Setting the limit
+ * too high causes extra messages. Too low causes transmitter
+ * stalls. As stalls are in theory more expensive than extra
+ * messages, we set the limit to a high value. TODO: experiment
+ * with different values.
*/
if (free_space < VIRTIO_VSOCK_MAX_PKT_BUF_SIZE) {
virtio_transport_send_credit_update(vsk,