Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Nov 2002 23:34:36 -0500
From:      Jake Burkholder <jake@locore.ca>
To:        Matthew Jacob <mjacob@feral.com>
Cc:        "Alan L. Cox" <alc@imimic.com>, jeff@freebsd.org, cvs-committers@freebsd.org, cvs-all@freebsd.org
Subject:   Re: cvs commit: src/sys/vm uma_dbg.c
Message-ID:  <20021110233436.C85338@locore.ca>
In-Reply-To: <Pine.BSF.4.21.0211101820030.62965-100000@beppo>; from mjacob@feral.com on Sun, Nov 10, 2002 at 06:24:42PM -0800
References:  <Pine.BSF.4.21.0211101810230.62965-100000@beppo> <Pine.BSF.4.21.0211101820030.62965-100000@beppo>

next in thread | previous in thread | raw e-mail | index | archive | help
Apparently, On Sun, Nov 10, 2002 at 06:24:42PM -0800,
	Matthew Jacob said words to the effect of;

> 
> 
> > > 
> > > Matt, can you try acquiring and releasing the zone mutex in
> > > uma_dbg_alloc() and uma_dbg_free() instead?
> > > 
> > 
> > Sure- let me look at this a little closer - I'll interrupt the make
> > release and try a different approach.
> 
> The trouble is that slab_zalloc sets value in us_freelist with the zone
> lock not held.
> 
> THe locking for falling uma_dbg_alloc and uma_dbg_free doesn't seem all
> that consistent to me.
> 
> It's getting beyond my easy reading/fixing. If there is no MI atomic
> set/clear 8 (which, IMO, is kind of a bug), I'd just change us_freelist
> to be an int for now. This change seemed to make a difference- but it
> could be coincidence.
> 

This would be my suggestion:

Index: sys/vm/uma_core.c
===================================================================
RCS file: /home/ncvs/src/sys/vm/uma_core.c,v
retrieving revision 1.41
diff -u -r1.41 uma_core.c
--- sys/vm/uma_core.c	1 Nov 2002 01:01:27 -0000	1.41
+++ sys/vm/uma_core.c	11 Nov 2002 04:11:38 -0000
@@ -1348,7 +1348,9 @@
 			    ("uma_zalloc: Bucket pointer mangled."));
 			cache->uc_allocs++;
 #ifdef INVARIANTS
+			ZONE_LOCK(zone);
 			uma_dbg_alloc(zone, NULL, item);
+			ZONE_UNLOCK(zone);
 #endif
 			CPU_UNLOCK(zone, cpu);
 			if (zone->uz_ctor)
@@ -1698,10 +1700,12 @@
 			    ("uma_zfree: Freeing to non free bucket index."));
 			bucket->ub_bucket[bucket->ub_ptr] = item;
 #ifdef INVARIANTS
+			ZONE_LOCK(zone);
 			if (zone->uz_flags & UMA_ZFLAG_MALLOC)
 				uma_dbg_free(zone, udata, item);
 			else
 				uma_dbg_free(zone, NULL, item);
+			ZONE_UNLOCK(zone);
 #endif
 			CPU_UNLOCK(zone, cpu);
 			return;

uma_dbg_* are called with the zone lock held everywhere else, and the
us_freelist is used with the zone lock held everywhere else as well.
slab_zalloc is working on a newly created slab that doesn't have any
other references, so it doesn't need to be locked until its added to
the zone.

Jake

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021110233436.C85338>