aboutsummaryrefslogtreecommitdiff
path: root/lib/libmemstat
diff options
context:
space:
mode:
authorJeff Roberson <jeff@FreeBSD.org>2019-12-25 20:50:53 +0000
committerJeff Roberson <jeff@FreeBSD.org>2019-12-25 20:50:53 +0000
commit376b1ba394688c30627199725cd8f9a133164364 (patch)
tree1aa7071f3b85cce918ff145c85c1b1a07595e789 /lib/libmemstat
parent3639ac42e5f1e80708c957366d0db6f23fa584ab (diff)
downloadsrc-376b1ba394688c30627199725cd8f9a133164364.tar.gz
src-376b1ba394688c30627199725cd8f9a133164364.zip
Optimize fast path allocations by storing bucket headers in the per-cpu
cache area. This allows us to check on bucket space for all per-cpu buckets with a single cacheline access and fewer branches. Reviewed by: markj, rlibby Differential Revision: https://reviews.freebsd.org/D22825
Notes
Notes: svn path=/head/; revision=356080
Diffstat (limited to 'lib/libmemstat')
-rw-r--r--lib/libmemstat/memstat_uma.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/lib/libmemstat/memstat_uma.c b/lib/libmemstat/memstat_uma.c
index 7c292e7ba460..b5879d651f5f 100644
--- a/lib/libmemstat/memstat_uma.c
+++ b/lib/libmemstat/memstat_uma.c
@@ -438,28 +438,9 @@ memstat_kvm_uma(struct memory_type_list *list, void *kvm_handle)
mtp->mt_numallocs += ucp->uc_allocs;
mtp->mt_numfrees += ucp->uc_frees;
- if (ucp->uc_allocbucket != NULL) {
- ret = kread(kvm, ucp->uc_allocbucket,
- &ub, sizeof(ub), 0);
- if (ret != 0) {
- free(ucp_array);
- _memstat_mtl_empty(list);
- list->mtl_error = ret;
- return (-1);
- }
- mtp->mt_free += ub.ub_cnt;
- }
- if (ucp->uc_freebucket != NULL) {
- ret = kread(kvm, ucp->uc_freebucket,
- &ub, sizeof(ub), 0);
- if (ret != 0) {
- free(ucp_array);
- _memstat_mtl_empty(list);
- list->mtl_error = ret;
- return (-1);
- }
- mtp->mt_free += ub.ub_cnt;
- }
+ mtp->mt_free += ucp->uc_allocbucket.ucb_cnt;
+ mtp->mt_free += ucp->uc_freebucket.ucb_cnt;
+ mtp->mt_free += ucp->uc_crossbucket.ucb_cnt;
}
skip_percpu:
mtp->mt_size = kz.uk_size;