freebsd-nq/sys
David Malone a5c4836d39 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)
2000-08-19 08:32:59 +00:00
..
alpha Replace the mbuf external reference counting code with something 2000-08-19 08:32:59 +00:00
amd64 Replace the mbuf external reference counting code with something 2000-08-19 08:32:59 +00:00
boot Fixed determination method for sector size of the 2nd IDE HDD. 2000-08-15 08:17:03 +00:00
cam CAM, the module: scbus, da, cd, and st wrapped in one module. 2000-08-13 18:49:40 +00:00
coda Remove 42 unneeded #include <sys/ioccom.h>. 2000-05-03 07:31:38 +00:00
compat Fixed null pointer panic for accessing "meminfo" when there is no swap. 2000-08-12 21:08:42 +00:00
compile
conf - Fixed the conversion to bus_space interface. 2000-08-17 12:15:45 +00:00
contrib/dev Install mode 644, not mode 664 during kernel compile. Yes, Peter, I am 2000-08-15 11:06:56 +00:00
crypto sync with kame tree as of july00. tons of bug fixes/improvements. 2000-07-04 16:35:15 +00:00
ddb Previous commit changing SYSCTL_HANDLER_ARGS violated KNF. 2000-07-04 11:25:35 +00:00
dev Replace the mbuf external reference counting code with something 2000-08-19 08:32:59 +00:00
fs Introduce vop_stdinactive() and make it the default if no vop_inactive 2000-08-18 10:01:02 +00:00
geom Move the truncation code out of vn_open and into the open system call 2000-07-04 03:34:11 +00:00
gnu sync CCR register definitions with creative sources 2000-08-06 20:58:11 +00:00
i4b Borrow phk's axe and apply the next stage of config(8)'s evolution. 2000-06-13 22:28:50 +00:00
i386 Replace the mbuf external reference counting code with something 2000-08-19 08:32:59 +00:00
isa Add another USR modem. 2000-08-15 21:03:28 +00:00
isofs/cd9660 This patch corrects the first round of panics and hangs reported 2000-07-24 05:28:33 +00:00
kern Replace the mbuf external reference counting code with something 2000-08-19 08:32:59 +00:00
libkern Comment out unavailable call. This needs to be revisited when the entropy 2000-06-25 10:15:58 +00:00
miscfs Introduce vop_stdinactive() and make it the default if no vop_inactive 2000-08-18 10:01:02 +00:00
modules CAM, the module: scbus, da, cd, and st wrapped in one module. 2000-08-13 18:49:40 +00:00
msdosfs Certain error contitions cause msdosfs_rename() to decrement the 2000-07-14 11:52:56 +00:00
net The slip driver used to allocate a mbuf cluster without attaching 2000-08-18 08:02:31 +00:00
netatalk Just need to pass the address family to if_simloop(), not the whole sockaddr. 2000-05-24 21:16:56 +00:00
netatm Just need to pass the address family to if_simloop(), not the whole sockaddr. 2000-05-24 21:16:56 +00:00
netgraph Add three more control messages to complement their opposites: 2000-08-15 01:05:50 +00:00
netinet repair endianness issue in IN_MULTICAST(). 2000-08-15 07:34:08 +00:00
netinet6 Replace the mbuf external reference counting code with something 2000-08-19 08:32:59 +00:00
netipx Add $FreeBSD$ 2000-05-01 20:32:07 +00:00
netkey Replace the mbuf external reference counting code with something 2000-08-19 08:32:59 +00:00
netnatm Back out the previous change to the queue(3) interface. 2000-05-26 02:09:24 +00:00
netncp Previous commit changing SYSCTL_HANDLER_ARGS violated KNF. 2000-07-04 11:25:35 +00:00
netns Clean up some loose ends in the network code, including the X.25 and ISO 2000-02-13 03:32:07 +00:00
nfs This patch corrects the first round of panics and hangs reported 2000-07-24 05:28:33 +00:00
nfsclient This patch corrects the first round of panics and hangs reported 2000-07-24 05:28:33 +00:00
nfsserver This patch corrects the first round of panics and hangs reported 2000-07-24 05:28:33 +00:00
ntfs Back out the previous change to the queue(3) interface. 2000-05-26 02:09:24 +00:00
nwfs Previous commit changing SYSCTL_HANDLER_ARGS violated KNF. 2000-07-04 11:25:35 +00:00
pc98 Replace the mbuf external reference counting code with something 2000-08-19 08:32:59 +00:00
pccard Add some infrastructure support for dealing with large attribute 2000-08-10 17:35:11 +00:00
pci Replace the mbuf external reference counting code with something 2000-08-19 08:32:59 +00:00
posix4 Add $FreeBSD$ 2000-05-01 20:32:07 +00:00
powerpc Support bounce buffers for ISA DMA on the alpha. This is required for the 2000-06-19 18:41:27 +00:00
rpc
svr4 Regen. (Fix SYS_exit) 2000-07-29 10:07:38 +00:00
sys Replace the mbuf external reference counting code with something 2000-08-19 08:32:59 +00:00
tools remove crufty exec stuff, perl is in the base system 2000-06-27 19:09:55 +00:00
ufs Initialize *countp to 0 in stub for softdep_flushworklist(). 2000-08-09 00:41:54 +00:00
vm Minor cleanups: 2000-07-28 22:03:08 +00:00
Makefile Add in a hack that installs 'src/sys/${MACHINE_ARCH}/GENERIC.hints' as 2000-08-17 05:43:41 +00:00