diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-10-15 01:44:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-10-20 06:02:23 -0400 |
commit | 27b75c95f10d249574d9c4cb9dab878107faede8 (patch) | |
tree | 466656d86aaa395951e12b50903e730203c5f86f /include/linux/skbuff.h | |
parent | e6484930d7c73d324bccda7d43d131088da697b9 (diff) |
net: avoid RCU for NOCACHE dst
There is no point using RCU for dst we allocate for a very short time
(used once).
Change dst_release() to take DST_NOCACHE into account, but also change
skb_dst_set_noref() to force a refcount increment for such dst.
This is a _huge_ gain, because we dont waste memory to store xx thousand
of dsts. Instead of queueing them to RCU, we can free them instantly.
CPU caches can stay hot, re-using same memory blocks to hold temporary
dsts.
Note : remove unneeded smp_mb__before_atomic_dec(); in dst_release(),
since atomic_dec_return() implies a full memory barrier.
Stress test, 160.000.000 udp frames sent, IP route cache disabled
(DDOS).
Before:
real 0m38.091s
user 0m13.189s
sys 7m53.018s
After:
real 0m29.946s
user 0m12.157s
sys 7m40.605s
For reference, if IP route cache was enabled :
real 0m32.030s
user 0m10.521s
sys 8m15.243s
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r-- | include/linux/skbuff.h | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 05a358f1ba11..e6ba898de61c 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -460,19 +460,7 @@ static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst) | |||
460 | skb->_skb_refdst = (unsigned long)dst; | 460 | skb->_skb_refdst = (unsigned long)dst; |
461 | } | 461 | } |
462 | 462 | ||
463 | /** | 463 | extern void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst); |
464 | * skb_dst_set_noref - sets skb dst, without a reference | ||
465 | * @skb: buffer | ||
466 | * @dst: dst entry | ||
467 | * | ||
468 | * Sets skb dst, assuming a reference was not taken on dst | ||
469 | * skb_dst_drop() should not dst_release() this dst | ||
470 | */ | ||
471 | static inline void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst) | ||
472 | { | ||
473 | WARN_ON(!rcu_read_lock_held() && !rcu_read_lock_bh_held()); | ||
474 | skb->_skb_refdst = (unsigned long)dst | SKB_DST_NOREF; | ||
475 | } | ||
476 | 464 | ||
477 | /** | 465 | /** |
478 | * skb_dst_is_noref - Test if skb dst isnt refcounted | 466 | * skb_dst_is_noref - Test if skb dst isnt refcounted |