From owner-cvs-all Sat Aug 19 1:33: 5 2000 Delivered-To: cvs-all@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id CFFB337B422; Sat, 19 Aug 2000 01:33:00 -0700 (PDT) Received: (from dwmalone@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id BAA01688; Sat, 19 Aug 2000 01:33:00 -0700 (PDT) (envelope-from dwmalone@FreeBSD.org) Message-Id: <200008190833.BAA01688@freefall.freebsd.org> From: David Malone Date: Sat, 19 Aug 2000 01:33:00 -0700 (PDT) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/alpha/alpha machdep.c src/sys/dev/en midway.c src/sys/i386/i386 machdep.c src/sys/kern uipc_mbuf.c uipc_mbuf2.c uipc_syscalls.c src/sys/netinet6 ipsec.c src/sys/netkey key_debug.c src/sys/pc98/i386 machdep.c src/sys/pci if_sk.c ... X-FreeBSD-CVS-Branch: HEAD Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG dwmalone 2000/08/19 01:33:00 PDT Modified files: sys/alpha/alpha machdep.c sys/dev/en midway.c sys/i386/i386 machdep.c sys/kern uipc_mbuf.c uipc_mbuf2.c uipc_syscalls.c sys/netinet6 ipsec.c sys/netkey key_debug.c sys/pc98/i386 machdep.c sys/pci if_sk.c if_skreg.h if_ti.c if_tireg.h if_wb.c sys/sys mbuf.h socketvar.h usr.bin/netstat mbuf.c Log: 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 Reviewed by: alfred (glanced at by others on -net) Revision Changes Path 1.89 +6 -8 src/sys/alpha/alpha/machdep.c 1.20 +2 -2 src/sys/dev/en/midway.c 1.403 +6 -8 src/sys/i386/i386/machdep.c 1.55 +58 -28 src/sys/kern/uipc_mbuf.c 1.3 +2 -2 src/sys/kern/uipc_mbuf2.c 1.71 +26 -44 src/sys/kern/uipc_syscalls.c 1.6 +2 -2 src/sys/netinet6/ipsec.c 1.13 +3 -3 src/sys/netkey/key_debug.c 1.171 +6 -8 src/sys/pc98/i386/machdep.c 1.27 +15 -72 src/sys/pci/if_sk.c 1.12 +1 -2 src/sys/pci/if_skreg.h 1.34 +15 -72 src/sys/pci/if_ti.c 1.20 +1 -2 src/sys/pci/if_tireg.h 1.31 +8 -12 src/sys/pci/if_wb.c 1.53 +117 -62 src/sys/sys/mbuf.h 1.51 +1 -2 src/sys/sys/socketvar.h 1.19 +7 -3 src/usr.bin/netstat/mbuf.c To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message