Subject: Re: lock bug in getnewvnode, or uvm_km_kmemalloc/uvm_map ?
To: Chuck Silvers <chuq@chuq.com>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: tech-kern
Date: 11/29/2002 09:11:57
On Fri, Nov 29, 2002 at 08:53:36AM -0800, Chuck Silvers wrote:

 > > > 	amapwaitflag = (flags & UVM_KMF_NOWAIT) ? AMAP_EXTEND_NOWAIT : 0;

...snip...

 > in this case, I'll argue that code clarity is worth a few extra instructions,
 > since the runtime difference won't be detectable.  if you really care about
 > this, you might want to think about enhancing gcc to detect this pattern and
 > do some smarter constant folding.  maybe it does it already, I haven't looked
 > at the generated code.

In fact, if you do something like:

	const int amapwaitflag = (flags & UVM_KMF_NOWAIT) ?
	    AMAP_EXTEND_NOWAIT : 0;

...then the compiler might already be able to do the right thing.

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>