From bfb6b7a12125c6224708f58e83ade44227d9bbcd Mon Sep 17 00:00:00 2001 From: Jeff Roberson Date: Sun, 5 Jan 2020 22:54:25 +0000 Subject: [PATCH] The fix in r356353 was insufficient. Not every architecture returns 0 for EARLY_COUNTER. Only amd64 seems to. Suggested by: markj Reported by: lwhsu Reviewed by: markj PR: 243117 --- sys/vm/uma_core.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 9bd2c7418c68..8f45a7da382b 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -4153,8 +4153,10 @@ uma_zone_get_cur(uma_zone_t zone) int64_t nitems; u_int i; - nitems = counter_u64_fetch(zone->uz_allocs) - - counter_u64_fetch(zone->uz_frees); + nitems = 0; + if (zone->uz_allocs != EARLY_COUNTER && zone->uz_frees != EARLY_COUNTER) + nitems = counter_u64_fetch(zone->uz_allocs) - + counter_u64_fetch(zone->uz_frees); CPU_FOREACH(i) nitems += atomic_load_64(&zone->uz_cpu[i].uc_allocs) - atomic_load_64(&zone->uz_cpu[i].uc_frees); @@ -4168,7 +4170,9 @@ uma_zone_get_allocs(uma_zone_t zone) uint64_t nitems; u_int i; - nitems = counter_u64_fetch(zone->uz_allocs); + nitems = 0; + if (zone->uz_allocs != EARLY_COUNTER) + nitems = counter_u64_fetch(zone->uz_allocs); CPU_FOREACH(i) nitems += atomic_load_64(&zone->uz_cpu[i].uc_allocs); @@ -4181,7 +4185,9 @@ uma_zone_get_frees(uma_zone_t zone) uint64_t nitems; u_int i; - nitems = counter_u64_fetch(zone->uz_frees); + nitems = 0; + if (zone->uz_frees != EARLY_COUNTER) + nitems = counter_u64_fetch(zone->uz_frees); CPU_FOREACH(i) nitems += atomic_load_64(&zone->uz_cpu[i].uc_frees);