Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1376197

Re: [PATCH net v2] net: sched: do not requeue a NULL skb

From Eric Dumazet <eric.dumazet@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH net v2] net: sched: do not requeue a NULL skb
Date 2016-04-11 20:30 +0200
Message-ID <rmOL0-1Jw-9@gated-at.bofh.it> (permalink)
References (2 earlier) <rmKem-6GA-37@gated-at.bofh.it> <rmL0K-7lT-5@gated-at.bofh.it> <rmLN8-7Xx-21@gated-at.bofh.it> <rmMpQ-8jk-23@gated-at.bofh.it> <rmOrD-1z2-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, 2016-04-11 at 11:02 -0700, Cong Wang wrote:

> I am fine with either way as long as the loop stops on failure.
> Folding the test "if (skb)" into one also requires to retake the spinlock.

Adding the likely() in this path would probably help as well.

diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index f18c35024207..07202d9ac4f6 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -159,12 +159,14 @@ int sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q,
        if (validate)
                skb = validate_xmit_skb_list(skb, dev);
 
-       if (skb) {
+       if (likely(skb)) {
                HARD_TX_LOCK(dev, txq, smp_processor_id());
                if (!netif_xmit_frozen_or_stopped(txq))
                        skb = dev_hard_start_xmit(skb, dev, txq, &ret);
 
                HARD_TX_UNLOCK(dev, txq);
+       } else {
+               ... does all and return...
        }
        spin_lock(root_lock);

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net v2] net: sched: do not requeue a NULL skb Lars Persson <lars.persson@axis.com> - 2016-04-11 08:30 +0200
  Re: [PATCH net v2] net: sched: do not requeue a NULL skb Eric Dumazet <eric.dumazet@gmail.com> - 2016-04-11 15:30 +0200
    Re: [PATCH net v2] net: sched: do not requeue a NULL skb Lars Persson <lars.persson@axis.com> - 2016-04-11 15:40 +0200
      Re: [PATCH net v2] net: sched: do not requeue a NULL skb Eric Dumazet <eric.dumazet@gmail.com> - 2016-04-11 16:30 +0200
        Re: [PATCH net v2] net: sched: do not requeue a NULL skb Lars Persson <lars.persson@axis.com> - 2016-04-11 17:20 +0200
          Re: [PATCH net v2] net: sched: do not requeue a NULL skb Eric Dumazet <eric.dumazet@gmail.com> - 2016-04-11 18:00 +0200
            Re: [PATCH net v2] net: sched: do not requeue a NULL skb Cong Wang <xiyou.wangcong@gmail.com> - 2016-04-11 20:10 +0200
              Re: [PATCH net v2] net: sched: do not requeue a NULL skb Eric Dumazet <eric.dumazet@gmail.com> - 2016-04-11 20:30 +0200
                Re: [PATCH net v2] net: sched: do not requeue a NULL skb Eric Dumazet <eric.dumazet@gmail.com> - 2016-04-11 20:40 +0200
                Re: [PATCH net v2] net: sched: do not requeue a NULL skb Cong Wang <xiyou.wangcong@gmail.com> - 2016-04-12 01:20 +0200
                Re: [PATCH net v2] net: sched: do not requeue a NULL skb Eric Dumazet <eric.dumazet@gmail.com> - 2016-04-12 01:50 +0200
          Re: [PATCH net v2] net: sched: do not requeue a NULL skb Cong Wang <xiyou.wangcong@gmail.com> - 2016-04-11 20:00 +0200

csiph-web