Move updated of 'numopensockets' from bottom of sodealloc() to the top,
eliminating a second set of identical mutex operations at the bottom. This allows brief exceeding of the max sockets limit, but only by sockets in the last stages of being torn down.
This commit is contained in:
parent
3c57a41d7b
commit
c0e1415d51
@ -291,6 +291,7 @@ sodealloc(struct socket *so)
|
||||
|
||||
mtx_lock(&so_global_mtx);
|
||||
so->so_gencnt = ++so_gencnt;
|
||||
--numopensockets; /* Could be below, but faster here. */
|
||||
mtx_unlock(&so_global_mtx);
|
||||
if (so->so_rcv.sb_hiwat)
|
||||
(void)chgsbsize(so->so_cred->cr_uidinfo,
|
||||
@ -310,9 +311,6 @@ sodealloc(struct socket *so)
|
||||
SOCKBUF_LOCK_DESTROY(&so->so_snd);
|
||||
SOCKBUF_LOCK_DESTROY(&so->so_rcv);
|
||||
uma_zfree(socket_zone, so);
|
||||
mtx_lock(&so_global_mtx);
|
||||
--numopensockets;
|
||||
mtx_unlock(&so_global_mtx);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user