summaryrefslogtreecommitdiffstats
path: root/sys/netkey
diff options
context:
space:
mode:
authordwmalone <dwmalone@FreeBSD.org>2000-08-19 08:32:59 +0000
committerdwmalone <dwmalone@FreeBSD.org>2000-08-19 08:32:59 +0000
commitdf0e25bf6c3619217f1f2c8b5a35a6e706f2a0b4 (patch)
tree47f526cc36bae230ba5426a392413b1b46c0d678 /sys/netkey
parent2f92e39a0fe52366609e44e5a1978feb243c8755 (diff)
downloadFreeBSD-src-df0e25bf6c3619217f1f2c8b5a35a6e706f2a0b4.zip
FreeBSD-src-df0e25bf6c3619217f1f2c8b5a35a6e706f2a0b4.tar.gz
Replace the mbuf external reference counting code with something
that should be better. The old code counted references to mbuf clusters by using the offset of the cluster from the start of memory allocated for mbufs and clusters as an index into an array of chars, which did the reference counting. If the external storage was not a cluster then reference counting had to be done by the code using that external storage. NetBSD's system of linked lists of mbufs was cosidered, but Alfred felt it would have locking issues when the kernel was made more SMP friendly. The system implimented uses a pool of unions to track external storage. The union contains an int for counting the references and a pointer for forming a free list. The reference counts are incremented and decremented atomically and so should be SMP friendly. This system can track reference counts for any sort of external storage. Access to the reference counting stuff is now through macros defined in mbuf.h, so it should be easier to make changes to the system in the future. The possibility of storing the reference count in one of the referencing mbufs was considered, but was rejected 'cos it would often leave extra mbufs allocated. Storing the reference count in the cluster was also considered, but because the external storage may not be a cluster this isn't an option. The size of the pool of reference counters is available in the stats provided by "netstat -m". PR: 19866 Submitted by: Bosko Milekic <bmilekic@dsuper.net> Reviewed by: alfred (glanced at by others on -net)
Diffstat (limited to 'sys/netkey')
-rw-r--r--sys/netkey/key_debug.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/netkey/key_debug.c b/sys/netkey/key_debug.c
index ebd06c3..3e8b12b 100644
--- a/sys/netkey/key_debug.c
+++ b/sys/netkey/key_debug.c
@@ -646,9 +646,9 @@ kdebug_mbufhdr(m)
if (m->m_flags & M_EXT) {
printf(" m_ext{ ext_buf:%p ext_free:%p "
- "ext_size:%u ext_ref:%p }\n",
+ "ext_size:%u ref_cnt:%p }\n",
m->m_ext.ext_buf, m->m_ext.ext_free,
- m->m_ext.ext_size, m->m_ext.ext_ref);
+ m->m_ext.ext_size, m->m_ext.ref_cnt);
}
return;
OpenPOWER on IntegriCloud