1. 05 3月, 2011 1 次提交
    • E
      inetpeer: seqlock optimization · 65e8354e
      Eric Dumazet 提交于
      David noticed :
      
      ------------------
      Eric, I was profiling the non-routing-cache case and something that
      stuck out is the case of calling inet_getpeer() with create==0.
      
      If an entry is not found, we have to redo the lookup under a spinlock
      to make certain that a concurrent writer rebalancing the tree does
      not "hide" an existing entry from us.
      
      This makes the case of a create==0 lookup for a not-present entry
      really expensive.  It is on the order of 600 cpu cycles on my
      Niagara2.
      
      I added a hack to not do the relookup under the lock when create==0
      and it now costs less than 300 cycles.
      
      This is now a pretty common operation with the way we handle COW'd
      metrics, so I think it's definitely worth optimizing.
      -----------------
      
      One solution is to use a seqlock instead of a spinlock to protect struct
      inet_peer_base.
      
      After a failed avl tree lookup, we can easily detect if a writer did
      some changes during our lookup. Taking the lock and redo the lookup is
      only necessary in this case.
      
      Note: Add one private rcu_deref_locked() macro to place in one spot the
      access to spinlock included in seqlock.
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      65e8354e
  2. 11 2月, 2011 2 次提交
  3. 05 2月, 2011 1 次提交
  4. 28 1月, 2011 1 次提交
  5. 25 1月, 2011 1 次提交
  6. 02 12月, 2010 1 次提交
  7. 01 12月, 2010 6 次提交
  8. 28 10月, 2010 1 次提交
  9. 17 6月, 2010 1 次提交
    • E
      inetpeer: restore small inet_peer structures · 317fe0e6
      Eric Dumazet 提交于
      Addition of rcu_head to struct inet_peer added 16bytes on 64bit arches.
      
      Thats a bit unfortunate, since old size was exactly 64 bytes.
      
      This can be solved, using an union between this rcu_head an four fields,
      that are normally used only when a refcount is taken on inet_peer.
      rcu_head is used only when refcnt=-1, right before structure freeing.
      
      Add a inet_peer_refcheck() function to check this assertion for a while.
      
      We can bring back SLAB_HWCACHE_ALIGN qualifier in kmem cache creation.
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      317fe0e6
  10. 16 6月, 2010 2 次提交
    • E
      inetpeer: do not use zero refcnt for freed entries · 5f2f8920
      Eric Dumazet 提交于
      Followup of commit aa1039e7 (inetpeer: RCU conversion)
      
      Unused inet_peer entries have a null refcnt.
      
      Using atomic_inc_not_zero() in rcu lookups is not going to work for
      them, and slow path is taken.
      
      Fix this using -1 marker instead of 0 for deleted entries.
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5f2f8920
    • E
      inetpeer: RCU conversion · aa1039e7
      Eric Dumazet 提交于
      inetpeer currently uses an AVL tree protected by an rwlock.
      
      It's possible to make most lookups use RCU
      
      1) Add a struct rcu_head to struct inet_peer
      
      2) add a lookup_rcu_bh() helper to perform lockless and opportunistic
      lookup. This is a normal function, not a macro like lookup().
      
      3) Add a limit to number of links followed by lookup_rcu_bh(). This is
      needed in case we fall in a loop.
      
      4) add an smp_wmb() in link_to_pool() right before node insert.
      
      5) make unlink_from_pool() use atomic_cmpxchg() to make sure it can take
      last reference to an inet_peer, since lockless readers could increase
      refcount, even while we hold peers.lock.
      
      6) Delay struct inet_peer freeing after rcu grace period so that
      lookup_rcu_bh() cannot crash.
      
      7) inet_getpeer() first attempts lockless lookup.
         Note this lookup can fail even if target is in AVL tree, but a
      concurrent writer can let tree in a non correct form.
         If this attemps fails, lock is taken a regular lookup is performed
      again.
      
      8) convert peers.lock from rwlock to a spinlock
      
      9) Remove SLAB_HWCACHE_ALIGN when peer_cachep is created, because
      rcu_head adds 16 bytes on 64bit arches, doubling effective size (64 ->
      128 bytes)
      In a future patch, this is probably possible to revert this part, if rcu
      field is put in an union to share space with rid, ip_id_count, tcp_ts &
      tcp_ts_stamp. These fields being manipulated only with refcnt > 0.
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      aa1039e7
  11. 15 6月, 2010 1 次提交
    • E
      inetpeer: various changes · d6cc1d64
      Eric Dumazet 提交于
      Try to reduce cache line contentions in peer management, to reduce IP
      defragmentation overhead.
      
      - peer_fake_node is marked 'const' to make sure its not modified.
        (tested with CONFIG_DEBUG_RODATA=y)
      
      - Group variables in two structures to reduce number of dirtied cache
      lines. One named "peers" for avl tree root, its number of entries, and
      associated lock. (candidate for RCU conversion)
      
      - A second one named "unused_peers" for unused list and its lock
      
      - Add a !list_empty() test in unlink_from_unused() to avoid taking lock
      when entry is not unused.
      
      - Use atomic_dec_and_lock() in inet_putpeer() to avoid taking lock in
      some cases.
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d6cc1d64
  12. 14 11月, 2009 1 次提交
    • E
      inetpeer: Optimize inet_getid() · 2c1409a0
      Eric Dumazet 提交于
      While investigating for network latencies, I found inet_getid() was a
      contention point for some workloads, as inet_peer_idlock is shared
      by all inet_getid() users regardless of peers.
      
      One way to fix this is to make ip_id_count an atomic_t instead
      of __u16, and use atomic_add_return().
      
      In order to keep sizeof(struct inet_peer) = 64 on 64bit arches
      tcp_ts_stamp is also converted to __u32 instead of "unsigned long".
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2c1409a0
  13. 03 11月, 2008 1 次提交
  14. 12 6月, 2008 1 次提交
  15. 13 11月, 2007 1 次提交
  16. 21 7月, 2007 1 次提交
    • P
      [IPV4]: Fix inetpeer gcc-4.2 warnings · fc7b9380
      Patrick McHardy 提交于
        CC      net/ipv4/inetpeer.o
      net/ipv4/inetpeer.c: In function 'unlink_from_pool':
      net/ipv4/inetpeer.c:297: warning: the address of 'stack' will always evaluate as 'true'
      net/ipv4/inetpeer.c:297: warning: the address of 'stack' will always evaluate as 'true'
      net/ipv4/inetpeer.c: In function 'inet_getpeer':
      net/ipv4/inetpeer.c:409: warning: the address of 'stack' will always evaluate as 'true'
      net/ipv4/inetpeer.c:409: warning: the address of 'stack' will always evaluate as 'true'
      
      "Fix" by checking for != NULL.
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fc7b9380
  17. 20 7月, 2007 1 次提交
    • P
      mm: Remove slab destructors from kmem_cache_create(). · 20c2df83
      Paul Mundt 提交于
      Slab destructors were no longer supported after Christoph's
      c59def9f change. They've been
      BUGs for both slab and slub, and slob never supported them
      either.
      
      This rips out support for the dtor pointer from kmem_cache_create()
      completely and fixes up every single callsite in the kernel (there were
      about 224, not including the slab allocator definitions themselves,
      or the documentation references).
      Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
      20c2df83
  18. 26 4月, 2007 1 次提交
    • E
      [IPV4]: Optimize inet_getpeer() · 243bbcaa
      Eric Dumazet 提交于
      1) Some sysctl vars are declared __read_mostly
      
      2) We can avoid updating stack[] when doing an AVL lookup only.
      
          lookup() macro is extended to receive a second parameter, that may be NULL
      in case of a pure lookup (no need to save the AVL path). This removes
      unnecessary instructions, because compiler knows if this _stack parameter is
      NULL or not.
      
          text size of net/ipv4/inetpeer.o is 2063 bytes instead of 2107 on x86_64
      Signed-off-by: NEric Dumazet <dada1@cosmosbay.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      243bbcaa
  19. 15 2月, 2007 1 次提交
    • T
      [PATCH] remove many unneeded #includes of sched.h · cd354f1a
      Tim Schmielau 提交于
      After Al Viro (finally) succeeded in removing the sched.h #include in module.h
      recently, it makes sense again to remove other superfluous sched.h includes.
      There are quite a lot of files which include it but don't actually need
      anything defined in there.  Presumably these includes were once needed for
      macros that used to live in sched.h, but moved to other header files in the
      course of cleaning it up.
      
      To ease the pain, this time I did not fiddle with any header files and only
      removed #includes from .c-files, which tend to cause less trouble.
      
      Compile tested against 2.6.20-rc2 and 2.6.20-rc2-mm2 (with offsets) on alpha,
      arm, i386, ia64, mips, powerpc, and x86_64 with allnoconfig, defconfig,
      allmodconfig, and allyesconfig as well as a few randconfigs on x86_64 and all
      configs in arch/arm/configs on arm.  I also checked that no new warnings were
      introduced by the patch (actually, some warnings are removed that were emitted
      by unnecessarily included header files).
      Signed-off-by: NTim Schmielau <tim@physik3.uni-rostock.de>
      Acked-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      cd354f1a
  20. 08 12月, 2006 1 次提交
  21. 16 10月, 2006 1 次提交
  22. 29 9月, 2006 1 次提交
  23. 23 9月, 2006 1 次提交
  24. 11 7月, 2006 1 次提交
  25. 10 1月, 2006 1 次提交
  26. 04 1月, 2006 1 次提交
  27. 10 9月, 2005 1 次提交
  28. 30 8月, 2005 3 次提交
  29. 24 8月, 2005 1 次提交
    • D
      [IPV4]: Fix negative timer loop with lots of ipv4 peers. · 1344a416
      Dave Johnson 提交于
      From: Dave Johnson <djohnson+linux-kernel@sw.starentnetworks.com>
      
      Found this bug while doing some scaling testing that created 500K inet
      peers.
      
      peer_check_expire() in net/ipv4/inetpeer.c isn't using inet_peer_gc_mintime
      correctly and will end up creating an expire timer with less than the
      minimum duration, and even zero/negative if enough active peers are
      present.
      
      If >65K peers, the timer will be less than inet_peer_gc_mintime, and with
      >70K peers, the timer duration will reach zero and go negative.
      
      The timer handler will continue to schedule another zero/negative timer in
      a loop until peers can be aged.  This can continue for at least a few
      minutes or even longer if the peers remain active due to arriving packets
      while the loop is occurring.
      
      Bug is present in both 2.4 and 2.6.  Same patch will apply to both just
      fine.
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1344a416
  30. 17 4月, 2005 1 次提交
    • L
      Linux-2.6.12-rc2 · 1da177e4
      Linus Torvalds 提交于
      Initial git repository build. I'm not bothering with the full history,
      even though we have it. We can create a separate "historical" git
      archive of that later if we want to, and in the meantime it's about
      3.2GB when imported into git - space that would just make the early
      git days unnecessarily complicated, when we don't have a lot of good
      infrastructure for it.
      
      Let it rip!
      1da177e4