* [PATCH net-next] vsock/virtio: a better comment on credit update
@ 2019-09-03 7:38 Michael S. Tsirkin
2019-09-03 7:47 ` Stefano Garzarella
2019-09-05 7:53 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2019-09-03 7:38 UTC (permalink / raw)
To: linux-kernel
Cc: Stefano Garzarella, Stefan Hajnoczi, David S. Miller, kvm,
virtualization, netdev
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>
---
net/vmw_vsock/virtio_transport_common.c | 9 +++++++--
1 file 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,
--
MST
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] vsock/virtio: a better comment on credit update
2019-09-03 7:38 [PATCH net-next] vsock/virtio: a better comment on credit update Michael S. Tsirkin
@ 2019-09-03 7:47 ` Stefano Garzarella
2019-09-05 7:53 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Stefano Garzarella @ 2019-09-03 7:47 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: linux-kernel, Stefan Hajnoczi, David S. Miller, kvm,
virtualization, netdev
On Tue, Sep 03, 2019 at 03:38:16AM -0400, Michael S. Tsirkin wrote:
> 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>
> ---
> net/vmw_vsock/virtio_transport_common.c | 9 +++++++--
> 1 file 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,
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] vsock/virtio: a better comment on credit update
2019-09-03 7:38 [PATCH net-next] vsock/virtio: a better comment on credit update Michael S. Tsirkin
2019-09-03 7:47 ` Stefano Garzarella
@ 2019-09-05 7:53 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-09-05 7:53 UTC (permalink / raw)
To: mst; +Cc: linux-kernel, sgarzare, stefanha, kvm, virtualization, netdev
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Tue, 3 Sep 2019 03:38:16 -0400
> 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>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-09-05 7:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03 7:38 [PATCH net-next] vsock/virtio: a better comment on credit update Michael S. Tsirkin
2019-09-03 7:47 ` Stefano Garzarella
2019-09-05 7:53 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).