alistair23-linux/net
Tim Chen 0856a30409 Scm: Remove unnecessary pid & credential references in Unix socket's send and receive path
Patch series 109f6e39..7361c36c back in 2.6.36 added functionality to
allow credentials to work across pid namespaces for packets sent via
UNIX sockets.  However, the atomic reference counts on pid and
credentials caused plenty of cache bouncing when there are numerous
threads of the same pid sharing a UNIX socket.  This patch mitigates the
problem by eliminating extraneous reference counts on pid and
credentials on both send and receive path of UNIX sockets. I found a 2x
improvement in hackbench's threaded case.

On the receive path in unix_dgram_recvmsg, currently there is an
increment of reference count on pid and credentials in scm_set_cred.
Then there are two decrement of the reference counts.  Once in scm_recv
and once when skb_free_datagram call skb->destructor function
unix_destruct_scm.  One pair of increment and decrement of ref count on
pid and credentials can be eliminated from the receive path.  Until we
destroy the skb, we already set a reference when we created the skb on
the send side.

On the send path, there are two increments of ref count on pid and
credentials, once in scm_send and once in unix_scm_to_skb.  Then there
is a decrement of the reference counts in scm_destroy's call to
scm_destroy_cred at the end of unix_dgram_sendmsg functions.   One pair
of increment and decrement of the reference counts can be removed so we
only need to increment the ref counts once.

By incorporating these changes, for hackbench running on a 4 socket
NHM-EX machine with 40 cores, the execution of hackbench on
50 groups of 20 threads sped up by factor of 2.

Hackbench command used for testing:
./hackbench 50 thread 2000

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-08-24 19:41:13 -07:00
..
9p net/9p: Fix the msize calculation. 2011-07-23 09:32:52 -05:00
802 rcu: convert uses of rcu_assign_pointer(x, NULL) to RCU_INIT_POINTER 2011-08-02 04:29:23 -07:00
8021q Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net 2011-08-20 10:39:12 -07:00
appletalk appletalk: Reduce switch/case indent 2011-07-01 16:11:15 -07:00
atm net: remove use of ndo_set_multicast_list in drivers 2011-08-17 20:22:03 -07:00
ax25
batman-adv batman-adv: merge update_transtable() into tt related code 2011-08-22 15:16:22 +02:00
bluetooth net: remove use of ndo_set_multicast_list in drivers 2011-08-17 20:22:03 -07:00
bridge Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net 2011-08-20 10:39:12 -07:00
caif rcu: convert uses of rcu_assign_pointer(x, NULL) to RCU_INIT_POINTER 2011-08-02 04:29:23 -07:00
can rcu: convert uses of rcu_assign_pointer(x, NULL) to RCU_INIT_POINTER 2011-08-02 04:29:23 -07:00
ceph Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client 2011-07-26 13:38:50 -07:00
core net: convert core to skb paged frag APIs 2011-08-24 17:52:11 -07:00
dcb dcbnl: unlock on an error path in dcbnl_cee_fill() 2011-07-08 09:01:14 -07:00
dccp Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net 2011-08-07 23:20:26 -07:00
decnet rcu: convert uses of rcu_assign_pointer(x, NULL) to RCU_INIT_POINTER 2011-08-02 04:29:23 -07:00
dns_resolver
dsa net: remove use of ndo_set_multicast_list in drivers 2011-08-17 20:22:03 -07:00
econet af_econet: Use current logging styles and neatening 2011-07-03 20:05:16 -07:00
ethernet net: add IFF_SKB_TX_SHARED flag to priv_flags 2011-07-27 22:39:30 -07:00
ieee802154 IEEE802.15.4: 6LoWPAN basic support 2011-08-24 19:36:06 -07:00
ipv4 Proportional Rate Reduction for TCP. 2011-08-24 19:40:40 -07:00
ipv6 net: ipv6: convert to SKB frag APIs 2011-08-24 17:52:12 -07:00
ipx
irda net: remove use of ndo_set_multicast_list in drivers 2011-08-17 20:22:03 -07:00
iucv af_iucv: add HiperSockets transport 2011-08-13 01:10:16 -07:00
key
l2tp Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2011-07-28 05:58:19 -07:00
lapb lapb: Reduce switch/case indent 2011-07-01 16:11:16 -07:00
llc
mac80211 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem 2011-08-22 14:28:50 -04:00
netfilter Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net 2011-08-07 23:20:26 -07:00
netlabel Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net 2011-08-20 10:39:12 -07:00
netlink net: cleanup some rcu_dereference_raw 2011-08-12 02:55:28 -07:00
netrom netrom: Reduce switch/case indent 2011-07-01 16:11:16 -07:00
nfc NFC: add the NFC socket raw protocol 2011-07-05 15:26:58 -04:00
packet af-packet: TPACKET_V3 flexible buffer implementation. 2011-08-24 19:40:40 -07:00
phonet rcu: convert uses of rcu_assign_pointer(x, NULL) to RCU_INIT_POINTER 2011-08-02 04:29:23 -07:00
rds notifiers: cpu: move cpu notifiers into cpu.h 2011-07-25 20:57:14 -07:00
rfkill
rose rose: Delete commented out references to ancient firewalling code. 2011-07-07 02:41:59 -07:00
rxrpc
sched net_sched: fix port mirror/redirect stats reporting 2011-08-17 20:10:20 -07:00
sctp sctp: Bundle HEAERTBEAT into ASCONF_ACK 2011-08-24 19:41:13 -07:00
sunrpc rcu: convert uses of rcu_assign_pointer(x, NULL) to RCU_INIT_POINTER 2011-08-02 04:29:23 -07:00
tipc atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
unix Scm: Remove unnecessary pid & credential references in Unix socket's send and receive path 2011-08-24 19:41:13 -07:00
wanrouter
wimax
wireless nl80211/cfg80211: Add extra IE configuration to AP mode setup 2011-08-12 13:45:04 -04:00
x25 x25: Reduce switch/case indent 2011-07-01 16:11:16 -07:00
xfrm net: xfrm: convert to SKB frag APIs 2011-08-24 17:52:12 -07:00
compat.c
Kconfig NFC: add nfc subsystem core 2011-07-05 15:26:57 -04:00
Makefile NFC: add nfc subsystem core 2011-07-05 15:26:57 -04:00
nonet.c
socket.c Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net 2011-08-07 23:20:26 -07:00
sysctl_net.c