dect
/
linux-2.6
Archived
13
0
Fork 0
This repository has been archived on 2022-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
linux-2.6/net/core
Eric Dumazet 2b85a34e91 net: No more expensive sock_hold()/sock_put() on each tx
One of the problem with sock memory accounting is it uses
a pair of sock_hold()/sock_put() for each transmitted packet.

This slows down bidirectional flows because the receive path
also needs to take a refcount on socket and might use a different
cpu than transmit path or transmit completion path. So these
two atomic operations also trigger cache line bounces.

We can see this in tx or tx/rx workloads (media gateways for example),
where sock_wfree() can be in top five functions in profiles.

We use this sock_hold()/sock_put() so that sock freeing
is delayed until all tx packets are completed.

As we also update sk_wmem_alloc, we could offset sk_wmem_alloc
by one unit at init time, until sk_free() is called.
Once sk_free() is called, we atomic_dec_and_test(sk_wmem_alloc)
to decrement initial offset and atomicaly check if any packets
are in flight.

skb_set_owner_w() doesnt call sock_hold() anymore

sock_wfree() doesnt call sock_put() anymore, but check if sk_wmem_alloc
reached 0 to perform the final freeing.

Drawback is that a skb->truesize error could lead to unfreeable sockets, or
even worse, prematurely calling __sk_free() on a live socket.

Nice speedups on SMP. tbench for example, going from 2691 MB/s to 2711 MB/s
on my 8 cpu dev machine, even if tbench was not really hitting sk_refcnt
contention point. 5 % speedup on a UDP transmit workload (depends
on number of flows), lowering TX completion cpu usage.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-06-11 02:55:43 -07:00
..
Makefile Network Drop Monitor: Adding Build changes to enable drop monitor 2009-03-13 12:09:29 -07:00
datagram.c datagram: Use frag list abstraction interfaces. 2009-06-09 00:18:15 -07:00
dev.c Add constants for the ieee 802.15.4 stack 2009-06-09 05:25:30 -07:00
dev_mcast.c net: Rationalise email address: Network Specific Parts 2008-10-13 19:01:08 -07:00
drop_monitor.c dropmon: add ability to detect when hardware dropsrxpackets 2009-05-21 16:50:21 -07:00
dst.c net: speedup dst_release() 2008-11-14 00:53:54 -08:00
ethtool.c core: remove pointless conditional before kfree() 2009-03-31 15:06:26 -07:00
fib_rules.c net: Remove unused parameter from fill method in fib_rules_ops. 2009-05-20 17:26:23 -07:00
filter.c filter: add SKF_AD_NLATTR_NEST to look for nested attributes 2008-11-20 00:49:27 -08:00
flow.c netns xfrm: lookup in netns 2008-11-25 17:35:18 -08:00
gen_estimator.c pkt_sched: gen_estimator: Fix signed integers right-shifts. 2009-05-25 22:47:01 -07:00
gen_stats.c [NET_SCHED]: Convert packet schedulers from rtnetlink to new netlink API 2008-01-28 15:11:10 -08:00
iovec.c net: Fix memcpy_toiovecend() to use the right offset 2009-06-08 00:25:39 -07:00
kmap_skb.h [PATCH] severing skbuff.h -> highmem.h 2006-12-04 02:00:29 -05:00
link_watch.c Revert "net: Fix for initial link state in 2.6.28" 2009-01-05 16:01:51 -08:00
neighbour.c net: skb->dst accessors 2009-06-03 02:51:04 -07:00
net-sysfs.c net: Remove bogus reference to BUS_ID_SIZE in sysfs code. 2009-05-26 21:05:19 -07:00
net-sysfs.h netns: Fix device renaming for sysfs 2008-05-02 17:00:58 -07:00
net-traces.c dropmon: add ability to detect when hardware dropsrxpackets 2009-05-21 16:50:21 -07:00
net_namespace.c netns: simplify net_ns_init 2009-05-21 15:10:31 -07:00
netevent.c [NET]: net/core/netevent.c should #include <net/netevent.h> 2007-07-05 17:40:27 -07:00
netpoll.c net: txq_trans_update() helper 2009-05-25 22:58:01 -07:00
pktgen.c net pkgen.c:fix no need for check 2009-06-08 00:40:35 -07:00
request_sock.c net: convert BUG_TRAP to generic WARN_ON 2008-07-25 21:43:18 -07:00
rtnetlink.c netlink: change nlmsg_notify() return value logic 2009-02-24 23:18:28 -08:00
scm.c Merge branch 'master' into next 2008-11-18 18:52:37 +11:00
skb_dma_map.c net: skb_shared_info optimization 2009-06-08 00:21:48 -07:00
skbuff.c mac80211: do not pass PS frames out of mac80211 again 2009-06-10 13:28:37 -04:00
sock.c net: No more expensive sock_hold()/sock_put() on each tx 2009-06-11 02:55:43 -07:00
stream.c tcp: tcp_prequeue() can use keyed wakeups 2009-05-17 20:44:43 -07:00
sysctl_net_core.c sysctl: fix sparse warning: Should it be static? 2009-02-26 23:13:34 -08:00
user_dma.c net/core/user_dma.c: Use frag list abstraction interfaces. 2009-06-09 00:19:10 -07:00
utils.c net: core: remove unneeded include in net/core/utils.c. 2009-03-26 01:11:48 -07:00