diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2014-10-03 02:16:22 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2014-10-03 02:16:22 +0000 |
commit | 23621f2ff0b5663756b9fae6a0d85b01d4711fc5 (patch) | |
tree | 0a450a30b6779f4cca7ea9efaaa01d2e6160f318 | |
parent | ca1d547193f05ada73256741b0b24dd3437493d9 (diff) |
if you're adding the first cluster reference, you dont have to
coordinate with other mbufs so you can add all the pointers without
taking the extref lock.
looks good deraadt@
-rw-r--r-- | sys/kern/uipc_mbuf.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 75a70cfb95c..64d05d8d906 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_mbuf.c,v 1.196 2014/10/03 01:11:17 dlg Exp $ */ +/* $OpenBSD: uipc_mbuf.c,v 1.197 2014/10/03 02:16:21 dlg Exp $ */ /* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */ /* @@ -344,14 +344,18 @@ m_free(struct mbuf *m) void m_extref(struct mbuf *o, struct mbuf *n) { + int refs = MCLISREFERENCED(o); + n->m_flags |= o->m_flags & (M_EXT|M_EXTWR); - mtx_enter(&m_extref_mtx); + if (refs) + mtx_enter(&m_extref_mtx); n->m_ext.ext_nextref = o->m_ext.ext_nextref; n->m_ext.ext_prevref = o; o->m_ext.ext_nextref = n; n->m_ext.ext_nextref->m_ext.ext_prevref = n; - mtx_leave(&m_extref_mtx); + if (refs) + mtx_leave(&m_extref_mtx); MCLREFDEBUGN((n), __FILE__, __LINE__); } |