All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] virtio_net: exploit napi_complete_done() return value
@ 2017-02-04 15:49 Eric Dumazet
  2017-02-05  0:39 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2017-02-04 15:49 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Jason Wang, Michael S. Tsirkin, Willem de Bruijn

From: Eric Dumazet <edumazet@google.com>

Since commit 364b6055738b ("net: busy-poll: return busypolling status to
drivers"), napi_complete_done() returns a boolean that can be used
by drivers to conditionally rearm interrupts.

This patch changes virtio_net to use this boolean to avoid a bit of
overhead for busy-poll users.

Jason reports about 1.1% improvement for 1 byte TCP_RR (burst 100).

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Willem de Bruijn <willemb@google.com>
---
 drivers/net/virtio_net.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 0382827829d90b1d25d059609bae6d1c5ad2b6d9..29982c7f6080ae99f4753052dc80ff5310f1134b 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1012,11 +1012,12 @@ static int virtnet_poll(struct napi_struct *napi, int budget)
 	/* Out of packets? */
 	if (received < budget) {
 		r = virtqueue_enable_cb_prepare(rq->vq);
-		napi_complete_done(napi, received);
-		if (unlikely(virtqueue_poll(rq->vq, r)) &&
-		    napi_schedule_prep(napi)) {
-			virtqueue_disable_cb(rq->vq);
-			__napi_schedule(napi);
+		if (napi_complete_done(napi, received)) {
+			if (unlikely(virtqueue_poll(rq->vq, r)) &&
+			    napi_schedule_prep(napi)) {
+				virtqueue_disable_cb(rq->vq);
+				__napi_schedule(napi);
+			}
 		}
 	}
 

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

* Re: [PATCH net-next] virtio_net: exploit napi_complete_done() return value
  2017-02-04 15:49 [PATCH net-next] virtio_net: exploit napi_complete_done() return value Eric Dumazet
@ 2017-02-05  0:39 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-02-05  0:39 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, jasowang, mst, willemb

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sat, 04 Feb 2017 07:49:21 -0800

> From: Eric Dumazet <edumazet@google.com>
> 
> Since commit 364b6055738b ("net: busy-poll: return busypolling status to
> drivers"), napi_complete_done() returns a boolean that can be used
> by drivers to conditionally rearm interrupts.
> 
> This patch changes virtio_net to use this boolean to avoid a bit of
> overhead for busy-poll users.
> 
> Jason reports about 1.1% improvement for 1 byte TCP_RR (burst 100).
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Acked-by: Jason Wang <jasowang@redhat.com>

Applied.

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

end of thread, other threads:[~2017-02-05  0:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-04 15:49 [PATCH net-next] virtio_net: exploit napi_complete_done() return value Eric Dumazet
2017-02-05  0:39 ` David Miller

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.