From owner-freebsd-net Thu Jul 11 23:41: 9 2002 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 93D2B37B400 for ; Thu, 11 Jul 2002 23:41:04 -0700 (PDT) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5362143E5E for ; Thu, 11 Jul 2002 23:41:04 -0700 (PDT) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id 0F3A2AE216; Thu, 11 Jul 2002 23:41:04 -0700 (PDT) Date: Thu, 11 Jul 2002 23:41:04 -0700 From: Alfred Perlstein To: Archie Cobbs Cc: Bosko Milekic , Julian Elischer , Luigi Rizzo , freebsd-net@FreeBSD.ORG Subject: Re: mbuf external buffer reference counters Message-ID: <20020712064104.GG97638@elvis.mu.org> References: <20020711222725.A5284@unixdaemons.com> <200207120519.g6C5JoH36140@arch20m.dellroad.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200207120519.g6C5JoH36140@arch20m.dellroad.org> User-Agent: Mutt/1.3.27i Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org * Archie Cobbs [020711 22:30] wrote: > Bosko Milekic writes: > > > mbufs that referred to the same object were linked together. > > > I forget the details exactly. maybe someone else can remember.. > > > it did it without ref counts somehow.. > > > > Yes, this is in NetBSD still and it is very elegant. I remember > > looking at this a long time ago but to be honest, the reason I didn't > > implement it then first escaped me. However, thanks to David Malone's > > awesome commit messages, I found it: > > > > rev 1.53 of sys/sys/mbuf.h, extract: > > [...] > > "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." > > [...] > > > > I think it's almost clear now that there are, in fact, no SMP issues > > with it (we don't do per-cluster locking, or anything ridiculous like > > that), so unless Alfred has the reason again, I'll consider that method > > again instead. Thanks for the constructive feedback. > > That's a cool idea.. haven't looked at NetBSD but am imagining the > mbufs would be linked in a 'ring'. This works because you never > care how many references are, just whether there's one or more than > one, and this is easy to tell by examining the ring pointer. > I.e., you never have to iterate through the entire ring. That's true, but could someone explain how one can safely and effeciently manipulate such a structure in an SMP environment? I'm not saying it's impossible, I'm just saying it didn't seem intuative to me back then, as well as now. -- -Alfred Perlstein [alfred@freebsd.org] To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message