From: Jarek Poplawski <jarkao2@gmail.com>
To: Alexander Duyck <alexander.h.duyck@intel.com>
Cc: netdev@vger.kernel.org, herbert@gondor.apana.org.au,
davem@davemloft.net, kaber@trash.net
Subject: Re: [RFC PATCH] sched: only dequeue if packet can be queued to hardware queue.
Date: Thu, 18 Sep 2008 21:44:19 +0200 [thread overview]
Message-ID: <20080918194419.GA2982@ami.dom.local> (raw)
In-Reply-To: <20080918063036.27934.91273.stgit@localhost.localdomain>
Alexander Duyck wrote, On 09/18/2008 08:43 AM:
...
> ---
> This patch changes the behavior of the sch->dequeue to only
> dequeue a packet if the queue it is bound for is not currently
> stopped. This functionality is provided via a new op called
> smart_dequeue.
>
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> ---
I think, these changes make sense only if they don't add more then give,
and two dequeues (and still no way to kill requeue) is IMHO too much.
(I mean the maintenance.) As far as I can see it's mainly for HFSC's
qdisc_peek_len(), anyway this looks like main issue to me.
Below a few small doubts. (I need to find some time for details yet.)
BTW, this patch needs a checkpatch run.
---
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index b786a5b..4082f39 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -90,10 +90,7 @@ extern void __qdisc_run(struct Qdisc *q);
static inline void qdisc_run(struct Qdisc *q)
{
- struct netdev_queue *txq = q->dev_queue;
-
- if (!netif_tx_queue_stopped(txq) &&
I think, there is no reason to do a full dequeue try each time instead
of this check, even if we save on requeuing now. We could try to save
the result of the last dequeue, e.g. a number or some mask of a few
tx_queues which prevented dequeuing, and check for the change of state
only. (Or alternatively, what I mentioned before: a flag set with the
full stop or freeze.)
- !test_and_set_bit(__QDISC_STATE_RUNNING, &q->state))
+ if (!test_and_set_bit(__QDISC_STATE_RUNNING, &q->state))
__qdisc_run(q);
}
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index e556962..4400a18 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
...
+static inline struct sk_buff *__qdisc_smart_dequeue(struct Qdisc *sch,
+ struct sk_buff_head *list)
+{
+ struct sk_buff *skb = skb_peek(list);
Since success is much more likely here, __skb_dequeue() with
__skb_queue_head() on fail looks better to me.
Of course, it's a matter of taste, but (if we really need these two
dequeues) maybe qdisc_dequeue_smart() would be more in line with
qdisc_dequeue_head()? (And similarly smart names below.)
+ struct netdev_queue *txq;
+
+ if (!skb)
+ return NULL;
+
+ txq = netdev_get_tx_queue(qdisc_dev(sch), skb_get_queue_mapping(skb));
+ if (netif_tx_queue_stopped(txq) || netif_tx_queue_frozen(txq)) {
+ sch->flags |= TCQ_F_STOPPED;
+ return NULL;
+ }
+ __skb_unlink(skb, list);
+ sch->qstats.backlog -= qdisc_pkt_len(skb);
+ sch->flags &= ~TCQ_F_STOPPED;
This clearing is probably needed in ->reset() and in ->drop() too.
(Or above, after if (!skb))
...
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index d14f020..4da1a85 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
...
+static struct sk_buff *htb_smart_dequeue(struct Qdisc *sch)
+{
+ struct sk_buff *skb = NULL;
+ struct htb_sched *q = qdisc_priv(sch);
+ int level, stopped = false;
+ psched_time_t next_event;
+
+ /* try to dequeue direct packets as high prio (!) to minimize cpu work */
+ skb = skb_peek(&q->direct_queue);
As above: __skb_dequeue()?
Thanks,
Jarek P.
next prev parent reply other threads:[~2008-09-18 19:43 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-18 6:43 [RFC PATCH] sched: only dequeue if packet can be queued to hardware queue Alexander Duyck
2008-09-18 6:56 ` Alexander Duyck
2008-09-18 9:46 ` David Miller
2008-09-18 14:51 ` Alexander Duyck
2008-09-18 19:44 ` Jarek Poplawski [this message]
2008-09-19 1:11 ` Alexander Duyck
2008-09-19 9:17 ` Jarek Poplawski
2008-09-19 10:32 ` [take 2] " Jarek Poplawski
2008-09-19 13:07 ` [PATCH] pkt_sched: Fix TX state checking in qdisc_run() Jarek Poplawski
2008-09-19 14:44 ` [PATCH take2] " Jarek Poplawski
2008-09-19 17:49 ` Jarek Poplawski
2008-09-21 5:18 ` David Miller
2008-09-19 17:46 ` [take 2] Re: [RFC PATCH] sched: only dequeue if packet can be queued to hardware queue Jarek Poplawski
2008-09-19 15:16 ` Jarek Poplawski
2008-09-19 16:26 ` Duyck, Alexander H
2008-09-19 17:35 ` Jarek Poplawski
2008-09-19 18:01 ` Duyck, Alexander H
2008-09-19 18:51 ` Jarek Poplawski
2008-09-19 21:43 ` Duyck, Alexander H
2008-09-19 16:37 ` Jarek Poplawski
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=20080918194419.GA2982@ami.dom.local \
--to=jarkao2@gmail.com \
--cc=alexander.h.duyck@intel.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=kaber@trash.net \
--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).