netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] [PATCH] Don't run __qdisc_run() on a stopped TX queue
@ 2009-07-20  7:46 Krishna Kumar
  2009-07-24  8:30 ` Jarek Poplawski
  2009-07-24 12:46 ` Eric Dumazet
  0 siblings, 2 replies; 43+ messages in thread
From: Krishna Kumar @ 2009-07-20  7:46 UTC (permalink / raw)
  To: davem, herbert; +Cc: netdev, Krishna Kumar

From: Krishna Kumar <krkumar2@in.ibm.com>

Driver sends an skb and stops the queue if no more space is
available on the device, and returns OK. When dev_queue_xmit
runs for the next skb, it enqueue's the skb & calls qdisc_run.
qdisc_run dequeue's the skb and finds the queue is stopped
after getting the HARD_LOCK_TX, and puts the skb back on
gso_skb (the next iteration fails faster at dequeue_skb).

This patch avoids calling __qdisc_run if the queue is stopped.
This also lets us remove the queue_stopped check in dequeue_skb
and in qdisc_restart. When the queue is re-enabled, it runs with
one less queue_stopped() check for every skb on the queue (we
still need to own the __QDISC_STATE_RUNNING bit to catch the
stopped condition correctly since stopped cannot be set without
holding this bit).

Results for 3 iteration testing for 1, 4, 8, 12 netperf sessions
running for 1 minute each:

-----------------------------------------------------------------
	       System-X			         P6
-----------------------------------------------------------------
Size	ORG BW		NEW BW		ORG BW		NEW BW
-----------------------------------------------------------------
16K	72183.05	74417.79	60775.76	63413.17
128K	69097.87	72447.12	61692.16	62251.07
256K	60456.21	61415.81	59694.03	61641.81
-----------------------------------------------------------------

Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
---

 include/net/pkt_sched.h |    9 +++++++--
 net/sched/sch_generic.c |    9 ++-------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff -ruNp org/include/net/pkt_sched.h new/include/net/pkt_sched.h
--- org/include/net/pkt_sched.h	2009-06-22 11:40:31.000000000 +0530
+++ new/include/net/pkt_sched.h	2009-07-20 13:09:18.000000000 +0530
@@ -92,8 +92,13 @@ extern void __qdisc_run(struct Qdisc *q)
 
 static inline void qdisc_run(struct Qdisc *q)
 {
-	if (!test_and_set_bit(__QDISC_STATE_RUNNING, &q->state))
-		__qdisc_run(q);
+	if (!test_and_set_bit(__QDISC_STATE_RUNNING, &q->state)) {
+		if (!netif_tx_queue_stopped(q->dev_queue))
+			__qdisc_run(q);
+		else
+			/* driver will wake us up anyway, just clear */
+			clear_bit(__QDISC_STATE_RUNNING, &q->state);
+	}
 }
 
 extern int tc_classify_compat(struct sk_buff *skb, struct tcf_proto *tp,
diff -ruNp org/net/sched/sch_generic.c new/net/sched/sch_generic.c
--- org/net/sched/sch_generic.c	2009-05-25 07:48:07.000000000 +0530
+++ new/net/sched/sch_generic.c	2009-07-20 13:09:18.000000000 +0530
@@ -56,12 +56,8 @@ static inline struct sk_buff *dequeue_sk
 	struct sk_buff *skb = q->gso_skb;
 
 	if (unlikely(skb)) {
-		struct net_device *dev = qdisc_dev(q);
-		struct netdev_queue *txq;
-
 		/* check the reason of requeuing without tx lock first */
-		txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb));
-		if (!netif_tx_queue_stopped(txq) && !netif_tx_queue_frozen(txq))
+		if (!netif_tx_queue_frozen(q->dev_queue))
 			q->gso_skb = NULL;
 		else
 			skb = NULL;
@@ -142,8 +138,7 @@ static inline int qdisc_restart(struct Q
 	txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb));
 
 	HARD_TX_LOCK(dev, txq, smp_processor_id());
-	if (!netif_tx_queue_stopped(txq) &&
-	    !netif_tx_queue_frozen(txq))
+	if (!netif_tx_queue_frozen(txq))
 		ret = dev_hard_start_xmit(skb, dev, txq);
 	HARD_TX_UNLOCK(dev, txq);
 

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

end of thread, other threads:[~2009-08-04  3:14 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-20  7:46 [RFC] [PATCH] Don't run __qdisc_run() on a stopped TX queue Krishna Kumar
2009-07-24  8:30 ` Jarek Poplawski
2009-07-24  8:37   ` Herbert Xu
2009-07-24 10:31     ` Krishna Kumar2
2009-07-25  3:24       ` Herbert Xu
2009-07-25 11:04         ` Jarek Poplawski
2009-07-25 11:12           ` Herbert Xu
2009-07-25 11:53             ` Jarek Poplawski
2009-07-28  2:28         ` David Miller
2009-07-28  2:48           ` Herbert Xu
2009-07-28  4:21             ` David Miller
2009-07-28  6:43               ` Jarek Poplawski
2009-07-28  8:03                 ` Herbert Xu
2009-07-28  8:37                   ` Jarek Poplawski
2009-07-28  8:44                     ` Herbert Xu
2009-07-28  9:02                       ` Jarek Poplawski
2009-07-28 10:53                         ` Herbert Xu
2009-07-28 11:24                           ` Jarek Poplawski
2009-07-28 11:43                             ` Krishna Kumar2
2009-07-28 11:48                               ` Herbert Xu
2009-07-28 12:24                                 ` Krishna Kumar2
2009-07-28 20:02                       ` David Miller
2009-07-28  7:12               ` Herbert Xu
2009-07-28 19:59                 ` David Miller
2009-07-29  0:44                   ` Herbert Xu
2009-07-29  1:06                     ` David Miller
2009-07-29  1:25                       ` Herbert Xu
2009-07-29  1:34                         ` David Miller
2009-07-29  2:12                           ` Herbert Xu
2009-07-29  2:22                             ` David Miller
2009-07-29  2:38                               ` Herbert Xu
2009-07-29  3:15                                 ` Herbert Xu
2009-08-04  3:15                                   ` David Miller
2009-07-29 11:04                     ` Jarek Poplawski
2009-07-29 11:11                       ` Herbert Xu
2009-07-29 11:26                         ` Jarek Poplawski
2009-07-29 12:30                           ` Herbert Xu
2009-07-29 12:47                             ` Jarek Poplawski
2009-07-29 13:08                               ` Krishna Kumar2
2009-07-29 19:26                                 ` Jarek Poplawski
2009-07-29 13:28                     ` Krishna Kumar2
2009-07-24 12:46 ` Eric Dumazet
2009-07-24 14:54   ` Herbert Xu

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).