From owner-freebsd-bugs Sat Jul 15 8:40: 6 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id D45FF37B99C for ; Sat, 15 Jul 2000 08:40:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id IAA51905; Sat, 15 Jul 2000 08:40:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Date: Sat, 15 Jul 2000 08:40:03 -0700 (PDT) Message-Id: <200007151540.IAA51905@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Bosko Milekic Subject: Re: kern/19866: The mbuf subsystem presently uses a horrible referencing scheme for external Reply-To: Bosko Milekic Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR kern/19866; it has been noted by GNATS. From: Bosko Milekic To: Alfred Perlstein Cc: freebsd-gnats-submit@FreeBSD.org Subject: Re: kern/19866: The mbuf subsystem presently uses a horrible referencing scheme for external Date: Sat, 15 Jul 2000 11:05:03 -0400 (EDT) I disagree. Especially since you haven't said why it's better than what's proposed. Of course, here's the reason why: If you are holding a POINTER to an outside reference counter, then you make think that you're accomodating things for counters outside the subsystem but in reality, if you are allocating objects of dynamic size with malloc() at some point, you don't really want to have to allocate and manage a reference count scheme for that one object anyway. I don't know about you but I want to be able to do malloc(), MEXTADD() the ext_buf to the mbuf, and be ready to go. Then, if m_copym ever gets called on my mbuf (or my mbuf is in the chain), I want it to be taken care of by itself, such that when the mbuf is freed, the ext_buf necessarily won't be. I don't want to have to malloc() extra space for a counter. So the point is: the mbuf subsystem is supposed to transparently manage the reference count scheme for itself and if the ext_free routine is called and there is an external reference (you can pass it using the ext_args pointer) then you don't necessarily need to free the object. If you still think it should be otherwise, let me know why and I'll change it, but I would like to get this off my back as soon as possible. On Fri, 14 Jul 2000, Alfred Perlstein wrote: > This is not how it should be done. > > Instead of keeping them in a linked list there should be an int/char * > in the mbuf header that works the same way mclrefcnt does. Instead > of managing a linked list all one has to do is copy the pointer into > the new mbuf header and increment it, and decrease it on free, when > it's zero the deref code is called. > > -- > -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] -- Bosko Milekic * Voice/Mobile: 514.865.7738 * Pager: 514.921.0237 bmilekic@technokratis.com * http://www.technokratis.com/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message