netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: "Jason Wang" <jasowang@redhat.com>,
	"Toke Høiland-Jørgensen" <toke@redhat.com>,
	netdev@vger.kernel.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: Tun congestion/BQL
Date: Thu, 11 Apr 2019 12:16:06 +0300	[thread overview]
Message-ID: <9c99b79071390729a5b9956fc49822654943c0eb.camel@infradead.org> (raw)
In-Reply-To: <f295999b-830b-a8b2-9812-9ee7ded38061@redhat.com>

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

On Thu, 2019-04-11 at 17:04 +0800, Jason Wang wrote:
> Btw, forget to mention, I modify your patch to use 
> netif_stop/wake_subqueue() instead.

Hm...


--- /usr/src/debug/kernel-5.0.fc29/linux-5.0.5-
200.fc29.x86_64/drivers/net/tun.c2019-03-03 23:21:29.000000000 +0000
+++ /home/fedora/tun/tun.c	2019-04-11 09:11:20.781683956 +0000
@@ -1118,8 +1118,14 @@ static netdev_tx_t tun_net_xmit(struct s
 
 	nf_reset(skb);
 
-	if (ptr_ring_produce(&tfile->tx_ring, skb))
+	if (ptr_ring_produce(&tfile->tx_ring, skb)) {
+		netif_stop_subqueue(tun->dev, txq);
 		goto drop;
+	}
+
+	if (ptr_ring_full(&tfile->tx_ring)) {
+		netif_stop_subqueue(tun->dev, txq);
+	}
 
 	/* Notify and wake up reader process */
 	if (tfile->flags & TUN_FASYNC)
@@ -2229,6 +2235,8 @@ static ssize_t tun_do_read(struct tun_st
 			consume_skb(skb);
 	}
 
+	netif_wake_subqueue(tun->dev, tfile->queue_index);
+
 	return ret;
 }
 

That gives me

Socket  Message  Elapsed      Messages                
Size    Size     Time         Okay Errors   Throughput
bytes   bytes    secs            #      #   10^6bits/sec

212992    1400   10.90     2277474      0    2340.95
212992           10.90     1174728           1207.47

Without the first netif_stop_subqueue() call in the case where we
actually *do* drop the packet (which AFAICT should never happen?) it
looks like this:

Socket  Message  Elapsed      Messages                
Size    Size     Time         Okay Errors   Throughput
bytes   bytes    secs            #      #   10^6bits/sec

212992    1400   10.00     7675563      0    8596.61
212992           10.00     1441186           1614.13

And without the patch at all, it was still faster when I just let it
drop packets:

Socket  Message  Elapsed      Messages                
Size    Size     Time         Okay Errors   Throughput
bytes   bytes    secs            #      #   10^6bits/sec

212992    1400   10.00     8143709      0    9120.93
212992           10.00     1545035           1730.44



[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5174 bytes --]

  reply	other threads:[~2019-04-11  9:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-10 12:01 Tun congestion/BQL David Woodhouse
2019-04-10 13:01 ` David Woodhouse
2019-04-10 13:25   ` Jason Wang
2019-04-10 13:42     ` Toke Høiland-Jørgensen
2019-04-10 14:33       ` David Woodhouse
2019-04-10 15:01         ` Toke Høiland-Jørgensen
2019-04-10 15:32           ` David Woodhouse
2019-04-11  7:22             ` Jason Wang
2019-04-11  9:25               ` David Woodhouse
2019-04-12  4:26                 ` Jason Wang
2019-04-12  5:45                   ` David Woodhouse
2019-04-11  7:17         ` Jason Wang
2019-04-11  8:56           ` David Woodhouse
2019-04-11  9:04             ` Jason Wang
2019-04-11  9:16               ` David Woodhouse [this message]
2019-04-12  4:23                 ` Jason Wang
2019-04-11  7:01       ` Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9c99b79071390729a5b9956fc49822654943c0eb.camel@infradead.org \
    --to=dwmw2@infradead.org \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=toke@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).