1. 24 9月, 2010 1 次提交
  2. 03 7月, 2010 2 次提交
  3. 29 6月, 2010 1 次提交
  4. 02 6月, 2010 3 次提交
    • E
      net: add additional lock to qdisc to increase throughput · 79640a4c
      Eric Dumazet 提交于
      When many cpus compete for sending frames on a given qdisc, the qdisc
      spinlock suffers from very high contention.
      
      The cpu owning __QDISC_STATE_RUNNING bit has same priority to acquire
      the lock, and cannot dequeue packets fast enough, since it must wait for
      this lock for each dequeued packet.
      
      One solution to this problem is to force all cpus spinning on a second
      lock before trying to get the main lock, when/if they see
      __QDISC_STATE_RUNNING already set.
      
      The owning cpu then compete with at most one other cpu for the main
      lock, allowing for higher dequeueing rate.
      
      Based on a previous patch from Alexander Duyck. I added the heuristic to
      avoid the atomic in fast path, and put the new lock far away from the
      cache line used by the dequeue worker. Also try to release the busylock
      lock as late as possible.
      
      Tests with following script gave a boost from ~50.000 pps to ~600.000
      pps on a dual quad core machine (E5450 @3.00GHz), tg3 driver.
      (A single netperf flow can reach ~800.000 pps on this platform)
      
      for j in `seq 0 3`; do
        for i in `seq 0 7`; do
          netperf -H 192.168.0.1 -t UDP_STREAM -l 60 -N -T $i -- -m 6 &
        done
      done
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Acked-by: NAlexander Duyck <alexander.h.duyck@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      79640a4c
    • E
      net: QDISC_STATE_RUNNING dont need atomic bit ops · 37112105
      Eric Dumazet 提交于
      __QDISC_STATE_RUNNING is always changed while qdisc lock is held.
      
      We can avoid two atomic operations in xmit path, if we move this bit in
      a new __state container.
      
      Location of this __state container is carefully chosen so that fast path
      only dirties one qdisc cache line.
      
      THROTTLED bit could later be moved into this __state location too, to
      avoid dirtying first qdisc cache line.
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      37112105
    • E
      net: Define accessors to manipulate QDISC_STATE_RUNNING · bc135b23
      Eric Dumazet 提交于
      Define three helpers to manipulate QDISC_STATE_RUNNIG flag, that a
      second patch will move on another location.
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bc135b23
  5. 02 4月, 2010 1 次提交
    • E
      gen_estimator: deadlock fix · 5d944c64
      Eric Dumazet 提交于
      One of my test machine got a deadlock during "tc" sessions,
      adding/deleting classes & filters, using traffic estimators.
      
      After some analysis, I believe we have a potential use after free case
      in est_timer() :
      
      spin_lock(e->stats_lock); << HERE >>
      read_lock(&est_lock);
      if (e->bstats == NULL)   << TEST >>
      	goto skip;
      
      Test is done a bit late, because after estimator is killed, and before
      rcu grace period elapsed, we might already have freed/reuse memory where
      e->stats_locks points to (some qdisc->q.lock)
      
      A possible fix is to respect a rcu grace period at Qdisc dismantle time.
      
      On 64bit, sizeof(struct Qdisc) is exactly 192 bytes. Adding 16 bytes to
      it (for struct rcu_head) is a problem because it might change
      performance, given QDISC_ALIGNTO is 32 bytes.
      
      This is why I also change QDISC_ALIGNTO to 64 bytes, to satisfy most
      current alignment requirements.
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5d944c64
  6. 29 1月, 2010 1 次提交
  7. 04 11月, 2009 1 次提交
  8. 15 9月, 2009 1 次提交
    • J
      pkt_sched: Fix tx queue selection in tc_modify_qdisc · 926e61b7
      Jarek Poplawski 提交于
      After the recent mq change there is the new select_queue qdisc class
      method used in tc_modify_qdisc, but it works OK only for direct child
      qdiscs of mq qdisc. Grandchildren always get the first tx queue, which
      would give wrong qdisc_root etc. results (e.g. for sch_htb as child of
      sch_prio). This patch fixes it by using parent's dev_queue for such
      grandchildren qdiscs. The select_queue method's return type is changed
      BTW.
      
      With feedback from: Patrick McHardy <kaber@trash.net>
      Signed-off-by: NJarek Poplawski <jarkao2@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      926e61b7
  9. 10 9月, 2009 1 次提交
    • P
      net_sched: fix estimator lock selection for mq child qdiscs · 23bcf634
      Patrick McHardy 提交于
      When new child qdiscs are attached to the mq qdisc, they are actually
      attached as root qdiscs to the device queues. The lock selection for
      new estimators incorrectly picks the root lock of the existing and
      to be replaced qdisc, which results in a use-after-free once the old
      qdisc has been destroyed.
      
      Mark mq qdisc instances with a new flag and treat qdiscs attached to
      mq as children similar to regular root qdiscs.
      
      Additionally prevent estimators from being attached to the mq qdisc
      itself since it only updates its byte and packet counters during dumps.
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      23bcf634
  10. 06 9月, 2009 2 次提交
  11. 18 8月, 2009 1 次提交
  12. 07 8月, 2009 1 次提交
    • K
      net: Avoid enqueuing skb for default qdiscs · bbd8a0d3
      Krishna Kumar 提交于
      dev_queue_xmit enqueue's a skb and calls qdisc_run which
      dequeue's the skb and xmits it. In most cases, the skb that
      is enqueue'd is the same one that is dequeue'd (unless the
      queue gets stopped or multiple cpu's write to the same queue
      and ends in a race with qdisc_run). For default qdiscs, we
      can remove the redundant enqueue/dequeue and simply xmit the
      skb since the default qdisc is work-conserving.
      
      The patch uses a new flag - TCQ_F_CAN_BYPASS to identify the
      default fast queue. The controversial part of the patch is
      incrementing qlen when a skb is requeued - this is to avoid
      checks like the second line below:
      
      +  } else if ((q->flags & TCQ_F_CAN_BYPASS) && !qdisc_qlen(q) &&
      >>         !q->gso_skb &&
      +          !test_and_set_bit(__QDISC_STATE_RUNNING, &q->state)) {
      
      Results of a 2 hour testing for multiple netperf sessions (1,
      2, 4, 8, 12 sessions on a 4 cpu system-X). The BW numbers are
      aggregate Mb/s across iterations tested with this version on
      System-X boxes with Chelsio 10gbps cards:
      
      ----------------------------------
      Size |  ORG BW          NEW BW   |
      ----------------------------------
      128K |  156964          159381   |
      256K |  158650          162042   |
      ----------------------------------
      
      Changes from ver1:
      
      1. Move sch_direct_xmit declaration from sch_generic.h to
         pkt_sched.h
      2. Update qdisc basic statistics for direct xmit path.
      3. Set qlen to zero in qdisc_reset.
      4. Changed some function names to more meaningful ones.
      Signed-off-by: NKrishna Kumar <krkumar2@in.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bbd8a0d3
  13. 20 3月, 2009 1 次提交
    • E
      net: reorder struct Qdisc for better SMP performance · 5e140dfc
      Eric Dumazet 提交于
      dev_queue_xmit() needs to dirty fields "state", "q", "bstats" and "qstats"
      
      On x86_64 arch, they currently span three cache lines, involving more
      cache line ping pongs than necessary, making longer holding of queue spinlock.
      
      We can reduce this to one cache line, by grouping all read-mostly fields
      at the beginning of structure. (Or should I say, all highly modified fields
      at the end :) )
      
      Before patch :
      
      offsetof(struct Qdisc, state)=0x38
      offsetof(struct Qdisc, q)=0x48
      offsetof(struct Qdisc, bstats)=0x80
      offsetof(struct Qdisc, qstats)=0x90
      sizeof(struct Qdisc)=0xc8
      
      After patch :
      
      offsetof(struct Qdisc, state)=0x80
      offsetof(struct Qdisc, q)=0x88
      offsetof(struct Qdisc, bstats)=0xa0
      offsetof(struct Qdisc, qstats)=0xac
      sizeof(struct Qdisc)=0xc0
      Signed-off-by: NEric Dumazet <dada1@cosmosbay.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5e140dfc
  14. 01 2月, 2009 1 次提交
  15. 14 11月, 2008 1 次提交
  16. 06 11月, 2008 1 次提交
  17. 31 10月, 2008 3 次提交
  18. 07 10月, 2008 1 次提交
  19. 23 9月, 2008 1 次提交
  20. 27 8月, 2008 2 次提交
  21. 21 8月, 2008 1 次提交
  22. 18 8月, 2008 2 次提交
    • D
      pkt_sched: No longer destroy qdiscs from RCU. · 1e0d5a57
      David S. Miller 提交于
      We can now kill them synchronously with all of the
      previous dev_deactivate() cures.
      
      This makes netdev destruction and shutdown saner as
      the qdiscs hold references to the device.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1e0d5a57
    • D
      pkt_sched: Add 'deactivated' state. · a9312ae8
      David S. Miller 提交于
      This new state lets dev_deactivate() mark a qdisc as having been
      deactivated.
      
      dev_queue_xmit() and ing_filter() check for this bit and do not
      try to process the qdisc if the bit is set.
      
      dev_deactivate() polls the qdisc after setting the bit, waiting
      for both __QDISC_STATE_RUNNING and __QDISC_STATE_SCHED to clear.
      
      This isn't perfect yet, but subsequent changesets will make it so.
      This part is just one piece of the puzzle.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a9312ae8
  23. 05 8月, 2008 2 次提交
    • J
      net_sched: Add qdisc __NET_XMIT_BYPASS flag · c27f339a
      Jarek Poplawski 提交于
      Patrick McHardy <kaber@trash.net> noticed that it would be nice to
      handle NET_XMIT_BYPASS by NET_XMIT_SUCCESS with an internal qdisc flag
      __NET_XMIT_BYPASS and to remove the mapping from dev_queue_xmit().
      
      David Miller <davem@davemloft.net> spotted a serious bug in the first
      version of this patch.
      Signed-off-by: NJarek Poplawski <jarkao2@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c27f339a
    • J
      net_sched: Add qdisc __NET_XMIT_STOLEN flag · 378a2f09
      Jarek Poplawski 提交于
      Patrick McHardy <kaber@trash.net> noticed:
      "The other problem that affects all qdiscs supporting actions is
      TC_ACT_QUEUED/TC_ACT_STOLEN getting mapped to NET_XMIT_SUCCESS
      even though the packet is not queued, corrupting upper qdiscs'
      qlen counters."
      
      and later explained:
      "The reason why it translates it at all seems to be to not increase
      the drops counter. Within a single qdisc this could be avoided by
      other means easily, upper qdiscs would still increase the counter
      when we return anything besides NET_XMIT_SUCCESS though.
      
      This means we need a new NET_XMIT return value to indicate this to
      the upper qdiscs. So I'd suggest to introduce NET_XMIT_STOLEN,
      return that to upper qdiscs and translate it to NET_XMIT_SUCCESS
      in dev_queue_xmit, similar to NET_XMIT_BYPASS."
      
      David Miller <davem@davemloft.net> noticed:
      "Maybe these NET_XMIT_* values being passed around should be a set of
      bits. They could be composed of base meanings, combined with specific
      attributes.
      
      So you could say "NET_XMIT_DROP | __NET_XMIT_NO_DROP_COUNT"
      
      The attributes get masked out by the top-level ->enqueue() caller,
      such that the base meanings are the only thing that make their
      way up into the stack. If it's only about communication within the
      qdisc tree, let's simply code it that way."
      
      This patch is trying to realize these ideas.
      Signed-off-by: NJarek Poplawski <jarkao2@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      378a2f09
  24. 03 8月, 2008 1 次提交
  25. 21 7月, 2008 1 次提交
  26. 20 7月, 2008 3 次提交
  27. 19 7月, 2008 1 次提交
  28. 18 7月, 2008 2 次提交