All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virtio-net: parameterize min ring num_free for virtio receive
@ 2019-07-18 12:55 ? jiang
  2019-07-18 13:04 ` Michael S. Tsirkin
  2019-07-18 13:04 ` Michael S. Tsirkin
  0 siblings, 2 replies; 19+ messages in thread
From: ? jiang @ 2019-07-18 12:55 UTC (permalink / raw)
  To: mst@redhat.com
  Cc: xdp-newbies@vger.kernel.org, songliubraving@fb.com,
	jakub.kicinski@netronome.com, hawk@kernel.org,
	daniel@iogearbox.net, jiangran.jr@alibaba-inc.com,
	netdev@vger.kernel.org, john.fastabend@gmail.com, ast@kernel.org,
	kafai@fb.com, ? jiang, yhs@fb.com, bpf@vger.kernel.org,
	virtualization@lists.linux-foundation.org, davem@davemloft.net,
	linux-kernel@vger.kernel.org

This change makes ring buffer reclaim threshold num_free configurable for better performance, while it's hard coded as 1/2 * queue now.
According to our test with qemu + dpdk, packet dropping happens when the guest is not able to provide free buffer in avail ring timely.
Smaller value of num_free does decrease the number of packet dropping during our test as it makes virtio_net reclaim buffer earlier.

At least, we should leave the value changeable to user while the default value as 1/2 * queue is kept.

Signed-off-by: jiangkidd <jiangkidd@hotmail.com>
---
 drivers/net/virtio_net.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 0d4115c9e20b..bc190dec6084 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -26,6 +26,9 @@
 static int napi_weight = NAPI_POLL_WEIGHT;
 module_param(napi_weight, int, 0444);
 
+static int min_numfree;
+module_param(min_numfree, int, 0444);
+
 static bool csum = true, gso = true, napi_tx;
 module_param(csum, bool, 0444);
 module_param(gso, bool, 0444);
@@ -1315,6 +1318,9 @@ static int virtnet_receive(struct receive_queue *rq, int budget,
 	void *buf;
 	int i;
 
+	if (!min_numfree)
+		min_numfree = virtqueue_get_vring_size(rq->vq) / 2;
+
 	if (!vi->big_packets || vi->mergeable_rx_bufs) {
 		void *ctx;
 
@@ -1331,7 +1337,7 @@ static int virtnet_receive(struct receive_queue *rq, int budget,
 		}
 	}
 
-	if (rq->vq->num_free > virtqueue_get_vring_size(rq->vq) / 2) {
+	if (rq->vq->num_free > min_numfree) {
 		if (!try_fill_recv(vi, rq, GFP_ATOMIC))
 			schedule_delayed_work(&vi->refill, 0);
 	}
-- 
2.11.0

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

end of thread, other threads:[~2019-08-14  2:12 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-18 12:55 [PATCH] virtio-net: parameterize min ring num_free for virtio receive ? jiang
2019-07-18 13:04 ` Michael S. Tsirkin
2019-07-18 13:04 ` Michael S. Tsirkin
2019-07-18 14:01   ` Jason Wang
2019-07-18 14:42     ` Michael S. Tsirkin
2019-07-18 14:42     ` Michael S. Tsirkin
2019-07-18 14:43       ` Michael S. Tsirkin
2019-07-19  2:36         ` Jason Wang
2019-07-19  2:36         ` Jason Wang
2019-07-19 14:29           ` 冉 jiang
     [not found]           ` <9c1bdbc5-e2c1-8dd7-52f9-1a4b43b86ff0@hotmail.com>
2019-07-19 15:31             ` 冉 jiang
2019-07-19 16:13               ` Michael S. Tsirkin
2019-07-19 16:13               ` Michael S. Tsirkin
2019-07-23 12:05                 ` 冉 jiang
2019-08-13 10:55                   ` Michael S. Tsirkin
2019-08-13 10:55                   ` Michael S. Tsirkin
2019-08-14  2:12                     ` 冉 jiang
2019-07-18 14:43       ` Michael S. Tsirkin
2019-07-18 14:01   ` Jason Wang

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.