Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Jan 2006 13:12:16 +0000
From:      Darren Reed <darrenr@hub.freebsd.org>
To:        Gleb Smirnoff <glebius@FreeBSD.org>
Cc:        cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/netinet ip_fw2.c
Message-ID:  <20060116131216.GA51815@hub.freebsd.org>
In-Reply-To: <20060116124714.GZ83922@FreeBSD.org>
References:  <200601150055.k0F0t52R028617@repoman.freebsd.org> <20060116123945.GA49077@hub.freebsd.org> <20060116124714.GZ83922@FreeBSD.org>

index | next in thread | previous in thread | raw e-mail

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


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060116131216.GA51815>