diff options
author | Jeff Roberson <jeff@FreeBSD.org> | 2020-02-19 18:48:46 +0000 |
---|---|---|
committer | Jeff Roberson <jeff@FreeBSD.org> | 2020-02-19 18:48:46 +0000 |
commit | c6fd3e23f753ef90d75fd706a2a39dfc1d5425c2 (patch) | |
tree | c341e1ea7e56bebfd338a334138a5f38c6967611 /lib/libmemstat | |
parent | e18651243efbc1fe285af34e4937fd697612f1c7 (diff) | |
download | src-c6fd3e23f753ef90d75fd706a2a39dfc1d5425c2.tar.gz src-c6fd3e23f753ef90d75fd706a2a39dfc1d5425c2.zip |
Use per-domain locks for the bucket cache.
This gives much better concurrency when there are a large number of
cores per-domain and multiple domains. Avoid taking the lock entirely
if it will not be productive. ROUNDROBIN domains will have mixed
memory in each domain and will load balance to all domains.
While here refactor the zone/domain separation and bucket limits to
simplify callers.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D23673
Notes
Notes:
svn path=/head/; revision=358128
Diffstat (limited to 'lib/libmemstat')
-rw-r--r-- | lib/libmemstat/memstat_uma.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libmemstat/memstat_uma.c b/lib/libmemstat/memstat_uma.c index f9d13dbc04a0..d014c3c2604a 100644 --- a/lib/libmemstat/memstat_uma.c +++ b/lib/libmemstat/memstat_uma.c @@ -425,12 +425,13 @@ memstat_kvm_uma(struct memory_type_list *list, void *kvm_handle) (unsigned long )uz.uz_frees); mtp->mt_failures = kvm_counter_u64_fetch(kvm, (unsigned long )uz.uz_fails); + mtp->mt_xdomain = kvm_counter_u64_fetch(kvm, + (unsigned long )uz.uz_xdomain); mtp->mt_sleeps = uz.uz_sleeps; /* See comment above in memstat_sysctl_uma(). */ if (mtp->mt_numallocs < mtp->mt_numfrees) mtp->mt_numallocs = mtp->mt_numfrees; - mtp->mt_xdomain = uz.uz_xdomain; if (kz.uk_flags & UMA_ZFLAG_INTERNAL) goto skip_percpu; for (i = 0; i < mp_maxid + 1; i++) { @@ -454,8 +455,9 @@ skip_percpu: 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_domain[i], &uzd, - sizeof(uzd), 0); + ret = kread(kvm, + &uz.uz_cpu[mp_maxid + 1] + i * sizeof(uzd), + &uzd, sizeof(uzd), 0); if (ret != 0) continue; for (ubp = |