summaryrefslogtreecommitdiff
path: root/kern
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-06-24 17:27:56 +0200
committerRichard Braun <rbraun@sceen.net>2017-06-24 17:31:09 +0200
commit13de6a8b39d2de95d37ae4a070481385dec4bf9c (patch)
treea952fd38e97810bd16bb436153b1cdb6aa816bfa /kern
parentfbc0e2bb5a835e03bf5dfa1d895b1f2d5f4441fe (diff)
kern/kmem: update console output format
Diffstat (limited to 'kern')
-rw-r--r--kern/kmem.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/kern/kmem.c b/kern/kmem.c
index b3c29788..6aded092 100644
--- a/kern/kmem.c
+++ b/kern/kmem.c
@@ -1099,23 +1099,22 @@ kmem_cache_info(struct kmem_cache *cache)
mutex_lock(&cache->lock);
- printf("kmem: name: %s\n"
- "kmem: flags: 0x%x%s\n"
- "kmem: obj_size: %zu\n"
- "kmem: align: %zu\n"
- "kmem: buf_size: %zu\n"
- "kmem: bufctl_dist: %zu\n"
- "kmem: slab_size: %zu\n"
- "kmem: color_max: %zu\n"
+ printf("kmem: flags: 0x%x%s\n"
+ "kmem: obj_size: %zu\n"
+ "kmem: align: %zu\n"
+ "kmem: buf_size: %zu\n"
+ "kmem: bufctl_dist: %zu\n"
+ "kmem: slab_size: %zu\n"
+ "kmem: color_max: %zu\n"
"kmem: bufs_per_slab: %lu\n"
- "kmem: nr_objs: %lu\n"
- "kmem: nr_bufs: %lu\n"
- "kmem: nr_slabs: %lu\n"
+ "kmem: nr_objs: %lu\n"
+ "kmem: nr_bufs: %lu\n"
+ "kmem: nr_slabs: %lu\n"
"kmem: nr_free_slabs: %lu\n"
- "kmem: buftag_dist: %zu\n"
- "kmem: redzone_pad: %zu\n"
- "kmem: cpu_pool_size: %d\n", cache->name, cache->flags, flags_str,
- cache->obj_size, cache->align, cache->buf_size, cache->bufctl_dist,
+ "kmem: buftag_dist: %zu\n"
+ "kmem: redzone_pad: %zu\n"
+ "kmem: cpu_pool_size: %d\n", cache->flags, flags_str, cache->obj_size,
+ cache->align, cache->buf_size, cache->bufctl_dist,
cache->slab_size, cache->color_max, cache->bufs_per_slab,
cache->nr_objs, cache->nr_bufs, cache->nr_slabs,
cache->nr_free_slabs, cache->buftag_dist, cache->redzone_pad,
@@ -1323,8 +1322,11 @@ kmem_free(void *ptr, size_t size)
void
kmem_info(void)
{
+ size_t mem_usage, mem_reclaimable, total, total_reclaimable;
struct kmem_cache *cache;
- size_t mem_usage, mem_reclaimable;
+
+ total = 0;
+ total_reclaimable = 0;
printf("kmem: cache obj slab bufs objs bufs "
" total reclaimable\n"
@@ -1338,6 +1340,8 @@ kmem_info(void)
mem_usage = (cache->nr_slabs * cache->slab_size) >> 10;
mem_reclaimable = (cache->nr_free_slabs * cache->slab_size) >> 10;
+ total += mem_usage;
+ total_reclaimable += mem_reclaimable;
printf("kmem: %-19s %6zu %3zuk %4lu %6lu %6lu %7zuk %10zuk\n",
cache->name, cache->obj_size, cache->slab_size >> 10,
@@ -1348,4 +1352,6 @@ kmem_info(void)
}
mutex_unlock(&kmem_cache_list_lock);
+
+ printf("total: %zuk reclaimable: %zuk\n", total, total_reclaimable);
}