Re: mbuf LOR

From: Andrew Gallatin <gallatin_at_cs.duke.edu>
Date: Fri, 4 Apr 2003 12:27:15 -0500 (EST)
Nate Lawson writes:
 > You're right about where the problem is (top of stack trace and listing 
 > below).  However, your patch causes an immediate panic on boot due to a 
 > NULL deref.  I don't think you want it to always return NULL if called 
 > with M_NOWAIT set.  :)  Other ideas?

The following patch boots & passed the basic 'make -j16 buildworld'
test on x86 SMP.  As I outlined before, I'm not certain if it is safe
on all platforms.

I'm really eager to see your fxp locking diffs.  Even if you're not
comfortable sharing them with the world yet, I'd be interested in
helping out on this.

Drew


Index: vm/uma_core.c
===================================================================
RCS file: /home/ncvs/src/sys/vm/uma_core.c,v
retrieving revision 1.51
diff -u -r1.51 uma_core.c
--- vm/uma_core.c	26 Mar 2003 18:44:53 -0000	1.51
+++ vm/uma_core.c	4 Apr 2003 15:11:34 -0000
_at__at_ -703,10 +703,15 _at__at_
 		wait &= ~M_ZERO;
 
 	if (booted || (zone->uz_flags & UMA_ZFLAG_PRIVALLOC)) {
-		mtx_lock(&Giant);
-		mem = zone->uz_allocf(zone, 
-		    zone->uz_ppera * UMA_SLAB_SIZE, &flags, wait);
-		mtx_unlock(&Giant);
+		if ((wait & M_NOWAIT) == 0) {
+			mtx_lock(&Giant);
+			mem = zone->uz_allocf(zone, 
+			    zone->uz_ppera * UMA_SLAB_SIZE, &flags, wait);
+			mtx_unlock(&Giant);
+		} else {
+			mem = zone->uz_allocf(zone, 
+			    zone->uz_ppera * UMA_SLAB_SIZE, &flags, wait);
+		}
 		if (mem == NULL) {
 			ZONE_LOCK(zone);
 			return (NULL);
Received on Fri Apr 04 2003 - 07:27:22 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:02 UTC