NET_NEEDS_GIANT removal

Robert Watson rwatson at FreeBSD.org
Fri Jun 1 11:17:32 UTC 2007


On Fri, 1 Jun 2007, Robert Watson wrote:

> This is the compatibility code that allows non-MPSAFE network protocols to 
> operate--when they are compiled into the kernel, Giant is forced over the 
> entire network stack.  This allows them to run moderately safely, but 
> eliminates use of more than one processor at a time in any part of the 
> network stack, as well as increasing contention on Giant for any other 
> non-MPSAFE components, requiring Giant be acquired in possible shared 
> ithreads, etc. The components currently requiring Giant are:

For those wondering what the results of this look like, I've start putting 
together an initial patch to remove the following compatibility shim parts 
associated with debug.mpsafenet:

- NET_NEEDS_GIANT()
- NET_LOCK_GIANT(), NET_UNLOCK_GIANT(), NET_ASSERT_GIANT()
- NET_CALLOUT_MPSAFE
- debug_mpsafenet

The draft is here:

   http://www.watson.org/~robert/freebsd/netperf/20070601-de_mpsafenet.diff

It does not yet compile (and it not tested), as parts requiring 
NET_NEEDS_GIANT() haven't been removed/disabled yet, but does begin to give a 
sense of how removing these shims cleans up many complex code paths.  Among 
other things, it removes 11 goto's in the socket exception handling code.

Robert N M Watson
Computer Laboratory
University of Cambridge


More information about the freebsd-current mailing list