Date: Fri, 12 Jul 2002 07:45:07 -0400 From: Bosko Milekic <bmilekic@unixdaemons.com> To: Jon Mini <baka@elvis.mu.org> Cc: Alfred Perlstein <bright@mu.org>, Archie Cobbs <archie@dellroad.org>, Julian Elischer <julian@elischer.org>, Luigi Rizzo <rizzo@icir.org>, freebsd-net@FreeBSD.ORG Subject: Re: mbuf external buffer reference counters Message-ID: <20020712074507.B75547@unixdaemons.com> In-Reply-To: <20020712112653.GS55378@elvis.mu.org>; from baka@elvis.mu.org on Fri, Jul 12, 2002 at 04:26:53AM -0700 References: <20020711222725.A5284@unixdaemons.com> <200207120519.g6C5JoH36140@arch20m.dellroad.org> <20020712064104.GG97638@elvis.mu.org> <20020712112653.GS55378@elvis.mu.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jul 12, 2002 at 04:26:53AM -0700, Jon Mini wrote: > On Thu, Jul 11, 2002 at 11:41:04PM -0700, Alfred Perlstein wrote: > > > 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. > > I'm probably speaking out of turn here (I have no idea what structure you > all are talking about), but a monodirectional ring can be safely modified > with a compare-and-exchange atomic operation. The jist of the problem is that when you want to say, remove yourself from the list, you have to: 1) your "next"'s back pointer to your "back" pointer 2) your "Prev"'s next pointer to your "next" pointer So that's two operations but for all you know your "next" or your "back" may be doing the same thing to you at the same time. As far as I know, you can't (intuitively) figure out a way to do both of these atomically. i.e., maybe you'll set your next's back pointer to whatever you have in `back' but then your `back' guy will set your back pointer to whatever he has in `back' and then your next guy's back pointer will be invalid, for example. So I guess that what we're dealing with isn't really a "monodirectional" ring. Right? > -- > Jonathan Mini <mini@freebsd.org> > http://www.freebsd.org/ Regards, -- Bosko Milekic bmilekic@unixdaemons.com bmilekic@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020712074507.B75547>