From owner-freebsd-arch Tue Dec 12 19: 9:52 2000 From owner-freebsd-arch@FreeBSD.ORG Tue Dec 12 19:09:50 2000 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mass.osd.bsdi.com (adsl-63-202-176-64.dsl.snfc21.pacbell.net [63.202.176.64]) by hub.freebsd.org (Postfix) with ESMTP id 1C7D037B400; Tue, 12 Dec 2000 19:09:50 -0800 (PST) Received: from mass.osd.bsdi.com (localhost [127.0.0.1]) by mass.osd.bsdi.com (8.11.1/8.11.1) with ESMTP id eBD3JH306370; Tue, 12 Dec 2000 19:19:27 -0800 (PST) (envelope-from msmith@mass.osd.bsdi.com) Message-Id: <200012130319.eBD3JH306370@mass.osd.bsdi.com> X-Mailer: exmh version 2.1.1 10/15/1999 To: Bosko Milekic Cc: Jason Evans , John Baldwin , arch@FreeBSD.ORG Subject: Re: An opaque refcount type In-reply-to: Your message of "Tue, 12 Dec 2000 22:05:00 EST." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 12 Dec 2000 19:19:17 -0800 From: Mike Smith Sender: msmith@mass.osd.bsdi.com Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > Okay, now that I've gotten somewhat in touch with how the implementation > is suggested, I have to bring up the following point, especially since > I feel it highlites an important point that Jason brings up below: > > Having a mutex accompany a ref. counter is really not a good idea. In > the problematic case outlined earlier regarding the mbuf ref. scheme, > you'll note that there is a reference counter accompanying EVERY SINGLE > ext buf. If you now throw in an extra mutex in there, you'll looking at > AT LEAST (NMBCLUSTERS * sizeof(mutex)) added wastage. And that's a lower > bound because it only covers clusters. Not to mention that all these > counters are pre-allocated, pre-wired. The BSD/OS folks use a neat technique where you have a small group of mutexes against which you hash a unique identifier for your object; eg. the address of the refcounter. This avoids the 1:1 noise, but still gives you a good chance of not blocking everything just because you're hitting a refcounter somewhere. -- ... every activity meets with opposition, everyone who acts has his rivals and unfortunately opponents also. But not because people want to be opponents, rather because the tasks and relationships force people to take different points of view. [Dr. Fritz Todt] V I C T O R Y N O T V E N G E A N C E To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message