diff options
author | Robert Watson <rwatson@FreeBSD.org> | 2004-06-26 19:10:39 +0000 |
---|---|---|
committer | Robert Watson <rwatson@FreeBSD.org> | 2004-06-26 19:10:39 +0000 |
commit | 1e4d7da707ea9277eb623e87861e8fe1affe8936 (patch) | |
tree | 0215a39aaab05d8f4180c75adc66451aa52aac5c /sys/netinet/ip_mroute.c | |
parent | df68e345c5b240f5f39fa18d02484b411a55e1d3 (diff) | |
download | src-1e4d7da707ea9277eb623e87861e8fe1affe8936.tar.gz src-1e4d7da707ea9277eb623e87861e8fe1affe8936.zip |
Reduce the number of unnecessary unlock-relocks on socket buffer mutexes
associated with performing a wakeup on the socket buffer:
- When performing an sbappend*() followed by a so[rw]wakeup(), explicitly
acquire the socket buffer lock and use the _locked() variants of both
calls. Note that the _locked() sowakeup() versions unlock the mutex on
return. This is done in uipc_send(), divert_packet(), mroute
socket_send(), raw_append(), tcp_reass(), tcp_input(), and udp_append().
- When the socket buffer lock is dropped before a sowakeup(), remove the
explicit unlock and use the _locked() sowakeup() variant. This is done
in soisdisconnecting(), soisdisconnected() when setting the can't send/
receive flags and dropping data, and in uipc_rcvd() which adjusting
back-pressure on the sockets.
For UNIX domain sockets running mpsafe with a contention-intensive SMP
mysql benchmark, this results in a 1.6% query rate improvement due to
reduce mutex costs.
Notes
Notes:
svn path=/head/; revision=131151
Diffstat (limited to 'sys/netinet/ip_mroute.c')
-rw-r--r-- | sys/netinet/ip_mroute.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index c4ef4879229d..9230d02434d8 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -1307,10 +1307,13 @@ static int socket_send(struct socket *s, struct mbuf *mm, struct sockaddr_in *src) { if (s) { - if (sbappendaddr(&s->so_rcv, (struct sockaddr *)src, mm, NULL) != 0) { - sorwakeup(s); + SOCKBUF_LOCK(&s->so_rcv); + if (sbappendaddr_locked(&s->so_rcv, (struct sockaddr *)src, mm, + NULL) != 0) { + sorwakeup_locked(s); return 0; } + SOCKBUF_UNLOCK(&s->so_rcv); } m_freem(mm); return -1; |