From owner-cvs-all Sun Nov 10 20:18:23 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 964BD37B401; Sun, 10 Nov 2002 20:18:21 -0800 (PST) Received: from k6.locore.ca (k6.locore.ca [198.96.117.170]) by mx1.FreeBSD.org (Postfix) with ESMTP id B4F2043E4A; Sun, 10 Nov 2002 20:18:20 -0800 (PST) (envelope-from jake@k6.locore.ca) Received: from k6.locore.ca (jake@localhost.locore.ca [127.0.0.1]) by k6.locore.ca (8.12.5/8.12.5) with ESMTP id gAB4Ybbd090780; Sun, 10 Nov 2002 23:34:37 -0500 (EST) (envelope-from jake@k6.locore.ca) Received: (from jake@localhost) by k6.locore.ca (8.12.5/8.12.5/Submit) id gAB4YaOW090779; Sun, 10 Nov 2002 23:34:36 -0500 (EST) Date: Sun, 10 Nov 2002 23:34:36 -0500 From: Jake Burkholder To: Matthew Jacob Cc: "Alan L. Cox" , 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> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from mjacob@feral.com on Sun, Nov 10, 2002 at 06:24:42PM -0800 Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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