From owner-cvs-all@FreeBSD.ORG Mon Jan 16 13:12:17 2006 Return-Path: X-Original-To: cvs-all@FreeBSD.org Delivered-To: cvs-all@FreeBSD.org Received: by hub.freebsd.org (Postfix, from userid 680) id EB2F616A426; Mon, 16 Jan 2006 13:12:16 +0000 (GMT) Date: Mon, 16 Jan 2006 13:12:16 +0000 From: Darren Reed To: Gleb Smirnoff Message-ID: <20060116131216.GA51815@hub.freebsd.org> References: <200601150055.k0F0t52R028617@repoman.freebsd.org> <20060116123945.GA49077@hub.freebsd.org> <20060116124714.GZ83922@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060116124714.GZ83922@FreeBSD.org> User-Agent: Mutt/1.4.2.1i Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/netinet ip_fw2.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jan 2006 13:12:17 -0000 On Mon, Jan 16, 2006 at 03:47:14PM +0300, Gleb Smirnoff wrote: > On Mon, Jan 16, 2006 at 12:39:45PM +0000, Darren Reed wrote: > D> I'll mention this again...this is bad programming for the kernel. > D> > D> While it works, it is incorrect because it doesn't use the locking > D> primitives that have been written for the radix tree. > D> > D> This is hack work - there is nothing clever or good about it. > D> > D> If there is a concern about locking around the radix tree impacting > D> performance then the correct thing to do is fix that, not to throw > D> away what exists today and use your own. In that way routing would > D> also benefit from the change, not just ipfw. > > There is no law to use locking in some subsystem, if the caller can > provide the safe access himself. It's called "good programming practice." > Radix doesn't have any locking in it. Radix is known to be not modified > by lookups. This means, that we can do lookups lockless, if we have a > guarantee that table won't be modified. Look in radix.h, you'll find RADIX_NODE_HEAD_LOCK and friends. These are part of the interface that is the radix implementation in FreeBSD. Interaction with the radix tree should therefore use that. Darren