Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Michael S. Tsirkin and committed by
David S. Miller
f4d7c8e3 9c895c1b

+7 -2
+7 -2
net/vmw_vsock/virtio_transport_common.c
··· 307 307 308 308 spin_unlock_bh(&vvs->rx_lock); 309 309 310 - /* We send a credit update only when the space available seen 311 - * by the transmitter is less than VIRTIO_VSOCK_MAX_PKT_BUF_SIZE 310 + /* To reduce the number of credit update messages, 311 + * don't update credits as long as lots of space is available. 312 + * Note: the limit chosen here is arbitrary. Setting the limit 313 + * too high causes extra messages. Too low causes transmitter 314 + * stalls. As stalls are in theory more expensive than extra 315 + * messages, we set the limit to a high value. TODO: experiment 316 + * with different values. 312 317 */ 313 318 if (free_space < VIRTIO_VSOCK_MAX_PKT_BUF_SIZE) { 314 319 virtio_transport_send_credit_update(vsk,