diff options
author | dwmalone <dwmalone@FreeBSD.org> | 2000-08-19 08:32:59 +0000 |
---|---|---|
committer | dwmalone <dwmalone@FreeBSD.org> | 2000-08-19 08:32:59 +0000 |
commit | df0e25bf6c3619217f1f2c8b5a35a6e706f2a0b4 (patch) | |
tree | 47f526cc36bae230ba5426a392413b1b46c0d678 /sys/dev/en | |
parent | 2f92e39a0fe52366609e44e5a1978feb243c8755 (diff) | |
download | FreeBSD-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/dev/en')
-rw-r--r-- | sys/dev/en/midway.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/dev/en/midway.c b/sys/dev/en/midway.c index 410d2f3..f397065 100644 --- a/sys/dev/en/midway.c +++ b/sys/dev/en/midway.c @@ -1833,7 +1833,7 @@ STATIC int en_makeexclusive(sc, mm, prev) return (0); } - if (mclrefcnt[mtocl(m->m_ext.ext_buf)] > 1) { + if (MEXT_IS_REF(m)) { /* make a real copy of the M_EXT mbuf since it is shared */ MGET(new, M_DONTWAIT, MT_DATA); if (!new) { |