Subject: UVM_KMF_NOWAIT collides with uvm_map() prot
To: None <tech-kern@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-kern
Date: 12/10/2002 23:40:41
--ReaqsoxgOBHFXBhH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi,
Perry sent me a mail about processes now dying with ENOMEM when they should
not, and could be related to the change I made to uvm_map() to handle
UVM_KMF_NOWAIT.
I think I've tracked it down to the value of UVM_KMF_NOWAIT: 0x01,
which is the same as UVM_PROT_READ (and if I'm not mistaken, both
UVM_PROT and UVM_KMF are stored in the first 4 bytes of flags).
because of this all read mapping get the NOWAIT property.
The only way I can see to fix it it to change the value of UVM_KMF_NOWAIT,
see attached patch.
Comments ?
Should we also change the other UVM_KMF_ values while there ?
--
Manuel Bouyer <bouyer@antioche.eu.org>
NetBSD: 23 ans d'experience feront toujours la difference
--
--ReaqsoxgOBHFXBhH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff
Index: uvm/uvm_extern.h
===================================================================
RCS file: /cvsroot/syssrc/sys/uvm/uvm_extern.h,v
retrieving revision 1.74
diff -u -r1.74 uvm_extern.h
--- uvm_extern.h 2002/11/17 08:32:45 1.74
+++ uvm_extern.h 2002/12/10 22:33:08
@@ -146,6 +146,7 @@
#define UVM_FLAG_COPYONW 0x080000 /* set copy_on_write flag */
#define UVM_FLAG_AMAPPAD 0x100000 /* for bss: pad amap to reduce malloc() */
#define UVM_FLAG_TRYLOCK 0x200000 /* fail if we can not lock map */
+#define UVM_FLAG_NOWAIT 0x400000 /* not allowed to sleep */
/* macros to extract info */
#define UVM_PROTECTION(X) ((X) & UVM_PROT_MASK)
@@ -162,10 +163,10 @@
/*
* the following defines are for uvm_km_kmemalloc's flags
*/
-#define UVM_KMF_NOWAIT 0x1 /* matches M_NOWAIT */
-#define UVM_KMF_VALLOC 0x2 /* allocate VA only */
-#define UVM_KMF_CANFAIL 0x4 /* caller handles failure */
+#define UVM_KMF_VALLOC 0x1 /* allocate VA only */
+#define UVM_KMF_CANFAIL 0x2 /* caller handles failure */
#define UVM_KMF_TRYLOCK UVM_FLAG_TRYLOCK /* try locking only */
+#define UVM_KMF_NOWAIT UVM_FLAG_NOWAIT /* not allowed to sleep */
/*
* the following defines the strategies for uvm_pagealloc_strat()
--ReaqsoxgOBHFXBhH--