]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
New way to manage reference counting of mbuf external storage.
authorglebius <glebius@FreeBSD.org>
Tue, 1 Mar 2016 00:17:14 +0000 (00:17 +0000)
committerglebius <glebius@FreeBSD.org>
Tue, 1 Mar 2016 00:17:14 +0000 (00:17 +0000)
commit163857deb49218689359c45361b584e1e3bea11f
tree5e3706d3c3c67b5379480ec58de16084b5a5f486
parent646a8831c3579d8a22b0f5b99555206ce7800134
New way to manage reference counting of mbuf external storage.

The m_ext.ext_cnt pointer becomes a union. It can now hold the refcount
value itself. To tell that m_ext.ext_flags flag EXT_FLAG_EMBREF is used.
The first mbuf to attach a cluster stores the refcount. The further mbufs
to reference the cluster point at refcount in the first mbuf. The first
mbuf is freed only when the last reference is freed.

The benefit over refcounts stored in separate slabs is that now refcounts
of different, unrelated mbufs do not share a cache line.

For EXT_EXTREF mbufs the zone_ext_refcnt is no longer needed, and m_extadd()
becomes void, making widely used M_EXTADD macro safe.

For EXT_SFBUF mbufs the sf_ext_ref() is removed, which was an optimization
exactly against the cache aliasing problem with regular refcounting.

Discussed with: rrs, rwatson, gnn, hiren, sbruno, np
Reviewed by: rrs
Differential Revision: https://reviews.freebsd.org/D5396
Sponsored by: Netflix
sys/dev/xen/netback/netback.c
sys/kern/kern_mbuf.c
sys/kern/kern_sendfile.c
sys/kern/uipc_mbuf.c
sys/netinet6/ip6_output.c
sys/netinet6/ip6_var.h
sys/sys/mbuf.h