From: Krishna Kumar <krkumar2@in.ibm.com>
To: davem@davemloft.net, herbert@gondor.apana.org.au
Cc: netdev@vger.kernel.org, Krishna Kumar <krkumar2@in.ibm.com>
Subject: [RFC] [PATCH] Don't run __qdisc_run() on a stopped TX queue
Date: Mon, 20 Jul 2009 13:16:07 +0530 [thread overview]
Message-ID: <20090720074607.32463.23013.sendpatchset@localhost.localdomain> (raw)
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);
next reply other threads:[~2009-07-20 7:46 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-20 7:46 Krishna Kumar [this message]
2009-07-24 8:30 ` [RFC] [PATCH] Don't run __qdisc_run() on a stopped TX queue 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
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=20090720074607.32463.23013.sendpatchset@localhost.localdomain \
--to=krkumar2@in.ibm.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@vger.kernel.org \
/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).