All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 5/5] VSOCK: batch sending rx buffer to increase bandwidth
@ 2018-12-12  9:35 jiangyiwen
  2018-12-13 15:17 ` Stefan Hajnoczi
  2018-12-13 15:17 ` Stefan Hajnoczi
  0 siblings, 2 replies; 5+ messages in thread
From: jiangyiwen @ 2018-12-12  9:35 UTC (permalink / raw)
  To: Stefan Hajnoczi, Michael S. Tsirkin, Jason Wang
  Cc: netdev, kvm, virtualization

Batch sending rx buffer can improve total bandwidth.

Signed-off-by: Yiwen Jiang <jiangyiwen@huawei.com>
---
 drivers/vhost/vsock.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
index 9600133..a4bf0a1 100644
--- a/drivers/vhost/vsock.c
+++ b/drivers/vhost/vsock.c
@@ -151,9 +151,11 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
 			    struct vhost_virtqueue *vq)
 {
 	struct vhost_virtqueue *tx_vq = &vsock->vqs[VSOCK_VQ_TX];
-	bool added = false;
 	bool restart_tx = false;
 	size_t vsock_hlen;
+	int batch_count = 0;
+
+#define VHOST_VSOCK_BATCH 16

 	mutex_lock(&vq->mutex);

@@ -194,8 +196,9 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
 		list_del_init(&pkt->list);
 		spin_unlock_bh(&vsock->send_pkt_list_lock);

-		headcount = get_rx_bufs(vq, vq->heads, vsock_hlen + pkt->len,
-				&in, likely(vsock->mergeable) ? UIO_MAXIOV : 1);
+		headcount = get_rx_bufs(vq, vq->heads + batch_count,
+				vsock_hlen + pkt->len, &in,
+				likely(vsock->mergeable) ? UIO_MAXIOV : 1);
 		if (headcount <= 0) {
 			spin_lock_bh(&vsock->send_pkt_list_lock);
 			list_add(&pkt->list, &vsock->send_pkt_list);
@@ -238,8 +241,12 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
 			remain_len -= tmp_len;
 		}

-		vhost_add_used_n(vq, vq->heads, headcount);
-		added = true;
+		batch_count += headcount;
+		if (batch_count > VHOST_VSOCK_BATCH) {
+			vhost_add_used_and_signal_n(&vsock->dev, vq,
+					vq->heads, batch_count);
+			batch_count = 0;
+		}

 		if (pkt->reply) {
 			int val;
@@ -258,8 +265,11 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,

 		virtio_transport_free_pkt(pkt);
 	}
-	if (added)
-		vhost_signal(&vsock->dev, vq);
+
+	if (batch_count) {
+		vhost_add_used_and_signal_n(&vsock->dev, vq,
+				vq->heads, batch_count);
+	}

 out:
 	mutex_unlock(&vq->mutex);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 5/5] VSOCK: batch sending rx buffer to increase bandwidth
  2018-12-12  9:35 [PATCH v2 5/5] VSOCK: batch sending rx buffer to increase bandwidth jiangyiwen
  2018-12-13 15:17 ` Stefan Hajnoczi
@ 2018-12-13 15:17 ` Stefan Hajnoczi
  2018-12-14  1:05   ` jiangyiwen
  2018-12-14  1:05   ` jiangyiwen
  1 sibling, 2 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2018-12-13 15:17 UTC (permalink / raw)
  To: jiangyiwen; +Cc: Michael S. Tsirkin, Jason Wang, netdev, kvm, virtualization

[-- Attachment #1: Type: text/plain, Size: 649 bytes --]

On Wed, Dec 12, 2018 at 05:35:27PM +0800, jiangyiwen wrote:
> Batch sending rx buffer can improve total bandwidth.
> 
> Signed-off-by: Yiwen Jiang <jiangyiwen@huawei.com>
> ---

Please send patches with git-send-email --thread --no-chain-reply-to so
that your patch series email thread looks like this:

  * [PATCH 00/NN] My feature
  +-- [PATCH 01/NN] First patch
  +-- [PATCH 02/NN] Second patch
  .
  .
  .
  +-- [PATCH NN/NN] Last patch

This way it's much easier to view the entire series.  At the moment you
are sending each patch as an independent email and there is no
relationship between the emails.

Thanks,
Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 5/5] VSOCK: batch sending rx buffer to increase bandwidth
  2018-12-12  9:35 [PATCH v2 5/5] VSOCK: batch sending rx buffer to increase bandwidth jiangyiwen
@ 2018-12-13 15:17 ` Stefan Hajnoczi
  2018-12-13 15:17 ` Stefan Hajnoczi
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2018-12-13 15:17 UTC (permalink / raw)
  To: jiangyiwen; +Cc: netdev, virtualization, kvm, Michael S. Tsirkin


[-- Attachment #1.1: Type: text/plain, Size: 649 bytes --]

On Wed, Dec 12, 2018 at 05:35:27PM +0800, jiangyiwen wrote:
> Batch sending rx buffer can improve total bandwidth.
> 
> Signed-off-by: Yiwen Jiang <jiangyiwen@huawei.com>
> ---

Please send patches with git-send-email --thread --no-chain-reply-to so
that your patch series email thread looks like this:

  * [PATCH 00/NN] My feature
  +-- [PATCH 01/NN] First patch
  +-- [PATCH 02/NN] Second patch
  .
  .
  .
  +-- [PATCH NN/NN] Last patch

This way it's much easier to view the entire series.  At the moment you
are sending each patch as an independent email and there is no
relationship between the emails.

Thanks,
Stefan

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 5/5] VSOCK: batch sending rx buffer to increase bandwidth
  2018-12-13 15:17 ` Stefan Hajnoczi
  2018-12-14  1:05   ` jiangyiwen
@ 2018-12-14  1:05   ` jiangyiwen
  1 sibling, 0 replies; 5+ messages in thread
From: jiangyiwen @ 2018-12-14  1:05 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: Michael S. Tsirkin, Jason Wang, netdev, kvm, virtualization

On 2018/12/13 23:17, Stefan Hajnoczi wrote:
> On Wed, Dec 12, 2018 at 05:35:27PM +0800, jiangyiwen wrote:
>> Batch sending rx buffer can improve total bandwidth.
>>
>> Signed-off-by: Yiwen Jiang <jiangyiwen@huawei.com>
>> ---
> 
> Please send patches with git-send-email --thread --no-chain-reply-to so
> that your patch series email thread looks like this:
> 
>   * [PATCH 00/NN] My feature
>   +-- [PATCH 01/NN] First patch
>   +-- [PATCH 02/NN] Second patch
>   .
>   .
>   .
>   +-- [PATCH NN/NN] Last patch
> 
> This way it's much easier to view the entire series.  At the moment you
> are sending each patch as an independent email and there is no
> relationship between the emails.
> 
> Thanks,
> Stefan
> 

Thanks Stefan, I have not send a series of patches before, and
I will use email thread form in the later version.

Thanks again,
Yiwen.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 5/5] VSOCK: batch sending rx buffer to increase bandwidth
  2018-12-13 15:17 ` Stefan Hajnoczi
@ 2018-12-14  1:05   ` jiangyiwen
  2018-12-14  1:05   ` jiangyiwen
  1 sibling, 0 replies; 5+ messages in thread
From: jiangyiwen @ 2018-12-14  1:05 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: netdev, virtualization, kvm, Michael S. Tsirkin

On 2018/12/13 23:17, Stefan Hajnoczi wrote:
> On Wed, Dec 12, 2018 at 05:35:27PM +0800, jiangyiwen wrote:
>> Batch sending rx buffer can improve total bandwidth.
>>
>> Signed-off-by: Yiwen Jiang <jiangyiwen@huawei.com>
>> ---
> 
> Please send patches with git-send-email --thread --no-chain-reply-to so
> that your patch series email thread looks like this:
> 
>   * [PATCH 00/NN] My feature
>   +-- [PATCH 01/NN] First patch
>   +-- [PATCH 02/NN] Second patch
>   .
>   .
>   .
>   +-- [PATCH NN/NN] Last patch
> 
> This way it's much easier to view the entire series.  At the moment you
> are sending each patch as an independent email and there is no
> relationship between the emails.
> 
> Thanks,
> Stefan
> 

Thanks Stefan, I have not send a series of patches before, and
I will use email thread form in the later version.

Thanks again,
Yiwen.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-12-14  1:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-12  9:35 [PATCH v2 5/5] VSOCK: batch sending rx buffer to increase bandwidth jiangyiwen
2018-12-13 15:17 ` Stefan Hajnoczi
2018-12-13 15:17 ` Stefan Hajnoczi
2018-12-14  1:05   ` jiangyiwen
2018-12-14  1:05   ` jiangyiwen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.