aboutsummaryrefslogtreecommitdiff
path: root/lib/libmemstat/memstat_uma.c
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2005-08-01 13:18:21 +0000
committerRobert Watson <rwatson@FreeBSD.org>2005-08-01 13:18:21 +0000
commit22247a2a387b580ee4ed82cbfc4cbac20f4efe72 (patch)
tree6861b8882f5a24ac61a27e8b26b5cdfc4d6acfcd /lib/libmemstat/memstat_uma.c
parente1d9e33240fafb62ad286f3275e578655963f312 (diff)
downloadsrc-22247a2a387b580ee4ed82cbfc4cbac20f4efe72.tar.gz
src-22247a2a387b580ee4ed82cbfc4cbac20f4efe72.zip
Correct two libmemstat(3) bugs:
- Move memory_type_list flushing logic from memstat_mtl_free() to _memstat_mtl_empty(), a libmemstat-internal function that can be called from other parts of the library. Invoke _memstat_mtl_empty() from memstat_mtl_free(), which also frees the containing list structure. Invoke _memstat_mtl_empty() instead of memstat_mtl_free() in various error cases in memstat_malloc.c and memstat_uma.c, which previously resulted in the list being freed prematurely. - Reverse the order of updating the mt_kegfree and mt_free fields of the memory_type in memstat_uma.c, otherwise keg free items won't be counted properly for non-secondary zones. MFC after: 3 days
Notes
Notes: svn path=/head/; revision=148619
Diffstat (limited to 'lib/libmemstat/memstat_uma.c')
-rw-r--r--lib/libmemstat/memstat_uma.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libmemstat/memstat_uma.c b/lib/libmemstat/memstat_uma.c
index 6d5407c72d0b..f1fb71059ca2 100644
--- a/lib/libmemstat/memstat_uma.c
+++ b/lib/libmemstat/memstat_uma.c
@@ -176,7 +176,7 @@ retry:
mtp = _memstat_mt_allocate(list, ALLOCATOR_UMA,
uthp->uth_name);
if (mtp == NULL) {
- memstat_mtl_free(list);
+ _memstat_mtl_empty(list);
free(buffer);
list->mtl_error = MEMSTAT_ERROR_NOMEMORY;
return (-1);
@@ -218,8 +218,8 @@ retry:
* items only in the primary zone.
*/
if (!(uthp->uth_zone_flags & UTH_ZONE_SECONDARY)) {
- mtp->mt_free += mtp->mt_kegfree;
mtp->mt_kegfree = uthp->uth_keg_free;
+ mtp->mt_free += mtp->mt_kegfree;
}
mtp->mt_free += mtp->mt_zonefree;
}