aboutsummaryrefslogtreecommitdiff
path: root/sys/vm/uma_core.c
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2005-07-14 16:17:21 +0000
committerRobert Watson <rwatson@FreeBSD.org>2005-07-14 16:17:21 +0000
commit773df9ab1650368f1c5a4587303d6a6b812e860b (patch)
tree35187bf6145198fd6ece5eecfb6230809004aaaf /sys/vm/uma_core.c
parent2c743d361a086a24991e135ca9becaf51a3c066d (diff)
downloadsrc-773df9ab1650368f1c5a4587303d6a6b812e860b.tar.gz
src-773df9ab1650368f1c5a4587303d6a6b812e860b.zip
In addition to tracking allocs in the zone, also track frees. Add
a zone free counter, as well as a cache free counter. MFC after: 1 week
Notes
Notes: svn path=/head/; revision=147995
Diffstat (limited to 'sys/vm/uma_core.c')
-rw-r--r--sys/vm/uma_core.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c
index 630b80b07d3e..7f82a435eae1 100644
--- a/sys/vm/uma_core.c
+++ b/sys/vm/uma_core.c
@@ -1325,6 +1325,7 @@ zone_ctor(void *mem, int size, void *udata, int flags)
zone->uz_init = NULL;
zone->uz_fini = NULL;
zone->uz_allocs = 0;
+ zone->uz_frees = 0;
zone->uz_fills = zone->uz_count = 0;
if (arg->flags & UMA_ZONE_SECONDARY) {
@@ -1894,6 +1895,8 @@ zalloc_start:
/* Since we have locked the zone we may as well send back our stats */
zone->uz_allocs += cache->uc_allocs;
cache->uc_allocs = 0;
+ zone->uz_frees += cache->uc_frees;
+ cache->uc_frees = 0;
/* Our old one is now a free bucket */
if (cache->uc_allocbucket) {
@@ -2296,6 +2299,7 @@ zfree_start:
("uma_zfree: Freeing to non free bucket index."));
bucket->ub_bucket[bucket->ub_cnt] = item;
bucket->ub_cnt++;
+ cache->uc_frees++;
critical_exit();
return;
} else if (cache->uc_allocbucket) {
@@ -2467,6 +2471,7 @@ uma_zfree_internal(uma_zone_t zone, void *item, void *udata,
/* Zone statistics */
keg->uk_free++;
+ zone->uz_frees++;
if (keg->uk_flags & UMA_ZFLAG_FULL) {
if (keg->uk_pages < keg->uk_maxpages)