Robert Watson <rwat...@freebsd.org> wrote: > On Fri, 17 Sep 2010, Andre Oppermann wrote: > > >> Although keeping free items around improves performance, it does consume > >> memory too. And the fact that that memory is not freed on lowmem > >> condition > >> makes the situation worse. > > > > Interesting. We may run into related issues with excessive mbuf (cluster) > > caching in the per-cpu buckets as well. > > > > Having a general solutions for that is appreciated. Maybe the size of the > > free per-cpu buckets should be specified when setting up the UMA zone. Of > > certain frequently re-used elements we may want to cache more, other less. > > I've been keeping a vague eye out for this over the last few years, and > haven't spotted many problems in production machines I've inspected. You can > use the umastat tool in the tools tree to look at the distribution of memory > over buckets (etc) in UMA manually.
Doesn't build for me on amd64: f...@r500 /usr/src/tools/tools/umastat $make Warning: Object directory not changed from original /usr/src/tools/tools/umastat cc -O2 -pipe -fno-omit-frame-pointer -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -c umastat.c cc1: warnings being treated as errors umastat.c: In function 'uma_print_bucketlist': umastat.c:234: warning: format '%llu' expects type 'long long unsigned int', but argument 3 has type 'uint64_t' umastat.c:234: warning: format '%llu' expects type 'long long unsigned int', but argument 4 has type 'uint64_t' umastat.c: In function 'uma_print_cache': umastat.c:245: warning: format '%llu' expects type 'long long unsigned int', but argument 3 has type 'u_int64_t' umastat.c:246: warning: format '%llu' expects type 'long long unsigned int', but argument 3 has type 'u_int64_t' umastat.c: In function 'main': umastat.c:416: warning: format '%llu' expects type 'long long unsigned int', but argument 2 has type 'u_int64_t' umastat.c:418: warning: format '%llu' expects type 'long long unsigned int', but argument 2 has type 'u_int64_t' umastat.c:420: warning: format '%llu' expects type 'long long unsigned int', but argument 2 has type 'u_int64_t' umastat.c:426: warning: dereferencing type-punned pointer will break strict-aliasing rules umastat.c:429: warning: dereferencing type-punned pointer will break strict-aliasing rules *** Error code 1 Stop in /usr/src/tools/tools/umastat. The attached patch seems to work around the problem, I'm not sure if the casts to void* are better than decreasing the WARN level, though ... Fabian
From b84b5cf4f24b6886b5db9885f5bea707dcfb11e8 Mon Sep 17 00:00:00 2001 From: Fabian Keil <f...@fabiankeil.de> Date: Sat, 18 Sep 2010 13:55:54 +0200 Subject: [PATCH] Work around umastat build failures on amd64. --- tools/tools/umastat/umastat.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/tools/umastat/umastat.c b/tools/tools/umastat/umastat.c index 3c9fe0e..639bf80 100644 --- a/tools/tools/umastat/umastat.c +++ b/tools/tools/umastat/umastat.c @@ -230,7 +230,7 @@ uma_print_bucketlist(kvm_t *kvm, struct bucketlist *bucketlist, } printf("\n"); - printf("%s}; // total cnt %llu, total entries %llu\n", spaces, + printf("%s}; // total cnt %ju, total entries %ju\n", spaces, total_cnt, total_entries); } @@ -242,8 +242,8 @@ uma_print_cache(kvm_t *kvm, struct uma_cache *cache, const char *name, int ret; printf("%s%s[%d] = {\n", spaces, name, cpu); - printf("%s uc_frees = %llu;\n", spaces, cache->uc_frees); - printf("%s uc_allocs = %llu;\n", spaces, cache->uc_allocs); + printf("%s uc_frees = %ju;\n", spaces, cache->uc_frees); + printf("%s uc_allocs = %ju;\n", spaces, cache->uc_allocs); if (cache->uc_freebucket != NULL) { ret = kread(kvm, cache->uc_freebucket, &ub, sizeof(ub), 0); @@ -412,20 +412,20 @@ main(int argc, char *argv[]) } printf(" Zone {\n"); printf(" uz_name = \"%s\";\n", name); - printf(" uz_allocs = %llu;\n", + printf(" uz_allocs = %ju;\n", uzp_userspace->uz_allocs); - printf(" uz_frees = %llu;\n", + printf(" uz_frees = %ju;\n", uzp_userspace->uz_frees); - printf(" uz_fails = %llu;\n", + printf(" uz_fails = %ju;\n", uzp_userspace->uz_fails); printf(" uz_fills = %u;\n", uzp_userspace->uz_fills); printf(" uz_count = %u;\n", uzp_userspace->uz_count); - uma_print_bucketlist(kvm, (struct bucketlist *) + uma_print_bucketlist(kvm, (void *) &uzp_userspace->uz_full_bucket, "uz_full_bucket", " "); - uma_print_bucketlist(kvm, (struct bucketlist *) + uma_print_bucketlist(kvm, (void *) &uzp_userspace->uz_free_bucket, "uz_free_bucket", " "); -- 1.7.2.3
signature.asc
Description: PGP signature