summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2002-05-02 09:05:36 +0000
committerjeff <jeff@FreeBSD.org>2002-05-02 09:05:36 +0000
commitfb737bd04bbaa01e816c020910e4eb4f70ab02bb (patch)
treeaf39017f7f36c72011c060f3b23a2851f287acae
parentfe3fc29868bc952085dc54394e74999fdd1dc3a2 (diff)
downloadFreeBSD-src-fb737bd04bbaa01e816c020910e4eb4f70ab02bb.zip
FreeBSD-src-fb737bd04bbaa01e816c020910e4eb4f70ab02bb.tar.gz
Move around the dbg code a bit so it's always under a lock. This stops a
weird potential race if we were preempted right as we were doing the dbg checks.
-rw-r--r--sys/vm/uma_core.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c
index 45adab4..39aca9e 100644
--- a/sys/vm/uma_core.c
+++ b/sys/vm/uma_core.c
@@ -1325,10 +1325,10 @@ zalloc_start:
KASSERT(item != NULL,
("uma_zalloc: Bucket pointer mangled."));
cache->uc_allocs++;
- CPU_UNLOCK(zone, cpu);
#ifdef INVARIANTS
uma_dbg_alloc(zone, NULL, item);
#endif
+ CPU_UNLOCK(zone, cpu);
if (zone->uz_ctor)
zone->uz_ctor(item, zone->uz_size, udata);
if (flags & M_ZERO)
@@ -1625,13 +1625,6 @@ uma_zfree_arg(uma_zone_t zone, void *item, void *udata)
if (zone->uz_flags & UMA_ZFLAG_FULL)
goto zfree_internal;
-#ifdef INVARIANTS
- if (zone->uz_flags & UMA_ZFLAG_MALLOC)
- uma_dbg_free(zone, udata, item);
- else
- uma_dbg_free(zone, NULL, item);
-#endif
-
zfree_restart:
cpu = PCPU_GET(cpuid);
CPU_LOCK(zone, cpu);
@@ -1653,6 +1646,12 @@ zfree_start:
bucket->ub_bucket[bucket->ub_ptr] = item;
if (zone->uz_dtor)
zone->uz_dtor(item, zone->uz_size, udata);
+#ifdef INVARIANTS
+ if (zone->uz_flags & UMA_ZFLAG_MALLOC)
+ uma_dbg_free(zone, udata, item);
+ else
+ uma_dbg_free(zone, NULL, item);
+#endif
CPU_UNLOCK(zone, cpu);
return;
} else if (cache->uc_allocbucket) {
OpenPOWER on IntegriCloud