summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2005-03-11 16:30:02 +0000
committerrwatson <rwatson@FreeBSD.org>2005-03-11 16:30:02 +0000
commit1723d628c51d72cc99e99fc848c4b4f1b5fdcafe (patch)
tree401d36cd378a3188a1ea34d047ee871416fd66b2
parent7f93ed151599dc8efcbd929944683e3ded715a84 (diff)
downloadFreeBSD-src-1723d628c51d72cc99e99fc848c4b4f1b5fdcafe.zip
FreeBSD-src-1723d628c51d72cc99e99fc848c4b4f1b5fdcafe.tar.gz
When setting up a socket in socreate(), there's no need to lock the
socket lock around knlist_init(), so don't. Hard code the setting of the socket reference count to 1 rather than using soref() to avoid asserting the socket lock, since we've not yet exposed the socket to other threads. This removes two mutex operations from each socket allocation.
-rw-r--r--sys/kern/uipc_socket.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 7a17014..b0951d3 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -211,11 +211,9 @@ socreate(dom, aso, type, proto, cred, td)
#ifdef MAC
mac_create_socket(cred, so);
#endif
- SOCK_LOCK(so);
knlist_init(&so->so_rcv.sb_sel.si_note, SOCKBUF_MTX(&so->so_rcv));
knlist_init(&so->so_snd.sb_sel.si_note, SOCKBUF_MTX(&so->so_snd));
- soref(so);
- SOCK_UNLOCK(so);
+ so->so_count = 1;
error = (*prp->pr_usrreqs->pru_attach)(so, proto, td);
if (error) {
ACCEPT_LOCK();
OpenPOWER on IntegriCloud