Subject: Re: lock bug in getnewvnode, or uvm_km_kmemalloc/uvm_map ?
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Chuck Silvers <chuq@chuq.com>
List: tech-kern
Date: 11/28/2002 09:29:19
it looks like you can factor out these expressions as well:

	(flags & UVM_KMF_NOWAIT) ? PR_NOWAIT : PR_WAITOK)

	(flags & UVM_KMF_NOWAIT) ?
	(AMAP_EXTEND_FORWARDS|AMAP_EXTEND_NOWAIT) :
	AMAP_EXTEND_FORWARDS)



also you're reversing the direction in:

@@ -807,7 +822,9 @@
                         */
                        if (prev_entry->next->aref.ar_amap) {
                                error = amap_extend(prev_entry->next, size,
-                                   AMAP_EXTEND_BACKWARDS);
+                                   (flags & UVM_KMF_NOWAIT) ?
+                                   (AMAP_EXTEND_FORWARDS|AMAP_EXTEND_NOWAIT) :
+                                   AMAP_EXTEND_FORWARDS);
                                if (error) {
                                        vm_map_unlock(map);
                                        if (new_entry) {



it'd be clearer if you just did

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

and then just combined that with the direction in each call.


-Chuck