cvs commit: src/sys/netinet ip_fw2.c

Darren Reed darrenr at hub.freebsd.org
Mon Jan 16 05:12:17 PST 2006


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


More information about the cvs-src mailing list