diff --git a/lib/libmemstat/memstat_uma.c b/lib/libmemstat/memstat_uma.c index d014c3c2604a..b416cbc63297 100644 --- a/lib/libmemstat/memstat_uma.c +++ b/lib/libmemstat/memstat_uma.c @@ -455,9 +455,8 @@ memstat_kvm_uma(struct memory_type_list *list, void *kvm_handle) mtp->mt_byteslimit = mtp->mt_countlimit * mtp->mt_size; mtp->mt_count = mtp->mt_numallocs - mtp->mt_numfrees; for (i = 0; i < ndomains; i++) { - ret = kread(kvm, - &uz.uz_cpu[mp_maxid + 1] + i * sizeof(uzd), - &uzd, sizeof(uzd), 0); + ret = kread(kvm, ZDOM_GET(uzp, i), &uzd, + sizeof(uzd), 0); if (ret != 0) continue; for (ubp = diff --git a/sys/vm/uma_int.h b/sys/vm/uma_int.h index 3c154ca75a47..b594c316e30b 100644 --- a/sys/vm/uma_int.h +++ b/sys/vm/uma_int.h @@ -526,6 +526,10 @@ struct uma_zone { KASSERT(uma_zone_get_allocs((z)) == 0, \ ("zone %s initialization after use.", (z)->uz_name)) +/* Domains are contiguous after the last CPU */ +#define ZDOM_GET(z, n) \ + (&((uma_zone_domain_t)&(z)->uz_cpu[mp_maxid + 1])[n]) + #undef UMA_ALIGN #ifdef _KERNEL @@ -561,10 +565,6 @@ static __inline uma_slab_t hash_sfind(struct uma_hash *hash, uint8_t *data); KASSERT(uma_keg_get_allocs((k)) == 0, \ ("keg %s initialization after use.", (k)->uk_name)) -/* Domains are contiguous after the last CPU */ -#define ZDOM_GET(z, n) \ - (&((uma_zone_domain_t)&(z)->uz_cpu[mp_maxid + 1])[n]) - #define ZDOM_LOCK_INIT(z, zdom, lc) \ do { \ if ((lc)) \