svn commit: r356389 - head/sys/vm
Jeff Roberson
jeff at FreeBSD.org
Sun Jan 5 22:54:26 UTC 2020
Author: jeff
Date: Sun Jan 5 22:54:25 2020
New Revision: 356389
URL: https://svnweb.freebsd.org/changeset/base/356389
Log:
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
Modified:
head/sys/vm/uma_core.c
Modified: head/sys/vm/uma_core.c
==============================================================================
--- head/sys/vm/uma_core.c Sun Jan 5 21:35:02 2020 (r356388)
+++ head/sys/vm/uma_core.c Sun Jan 5 22:54:25 2020 (r356389)
@@ -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);
More information about the svn-src-all
mailing list