From owner-freebsd-hackers@FreeBSD.ORG Sat Sep 18 12:49:13 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39C7F106566B; Sat, 18 Sep 2010 12:49:13 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from smtprelay01.ispgateway.de (smtprelay01.ispgateway.de [80.67.29.23]) by mx1.freebsd.org (Postfix) with ESMTP id BC0848FC0C; Sat, 18 Sep 2010 12:49:12 +0000 (UTC) Received: from [87.79.159.189] (helo=r500.local) by smtprelay01.ispgateway.de with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.68) (envelope-from ) id 1Owweq-0004gU-7a; Sat, 18 Sep 2010 14:36:44 +0200 Date: Sat, 18 Sep 2010 14:35:16 +0200 From: Fabian Keil To: Robert Watson Message-ID: <20100918143516.3568f40e@r500.local> In-Reply-To: References: <4C93236B.4050906@freebsd.org> <4C935F56.4030903@freebsd.org> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; amd64-portbld-freebsd9.0) X-PGP-KEY-URL: http://www.fabiankeil.de/gpg-keys/freebsd-listen-2008-08-18.asc Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/j0IIO6G0OvbQXQCJQewu8.K"; protocol="application/pgp-signature" X-Df-Sender: 775067 Cc: freebsd-hackers@freebsd.org Subject: Re: zfs + uma X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Sep 2010 12:49:13 -0000 --Sig_/j0IIO6G0OvbQXQCJQewu8.K Content-Type: multipart/mixed; boundary="MP_/V45ylbNW9Sv144uke8uKVXp" --MP_/V45ylbNW9Sv144uke8uKVXp Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Robert Watson wrote: > On Fri, 17 Sep 2010, Andre Oppermann wrote: >=20 > >> Although keeping free items around improves performance, it does consu= me=20 > >> memory too. And the fact that that memory is not freed on lowmem cond= ition=20 > >> makes the situation worse. > > > > Interesting. We may run into related issues with excessive mbuf (clust= er)=20 > > caching in the per-cpu buckets as well. > > > > Having a general solutions for that is appreciated. Maybe the size of = the=20 > > free per-cpu buckets should be specified when setting up the UMA zone. = Of=20 > > certain frequently re-used elements we may want to cache more, other le= ss. >=20 > I've been keeping a vague eye out for this over the last few years, and=20 > haven't spotted many problems in production machines I've inspected. You= can=20 > use the umastat tool in the tools tree to look at the distribution of mem= ory=20 > over buckets (etc) in UMA manually. Doesn't build for me on amd64: fk@r500 /usr/src/tools/tools/umastat $make Warning: Object directory not changed from original /usr/src/tools/tools/um= astat cc -O2 -pipe -fno-omit-frame-pointer -std=3Dgnu99 -fstack-protector -Wsyst= em-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-= prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-poi= nter-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 --MP_/V45ylbNW9Sv144uke8uKVXp Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0001-Work-around-umastat-build-failures-on-amd64.patch =46rom b84b5cf4f24b6886b5db9885f5bea707dcfb11e8 Mon Sep 17 00:00:00 2001 From: Fabian Keil 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 *buc= ketlist, } =20 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); } =20 @@ -242,8 +242,8 @@ uma_print_cache(kvm_t *kvm, struct uma_cache *cache, co= nst char *name, int ret; =20 printf("%s%s[%d] =3D {\n", spaces, name, cpu); - printf("%s uc_frees =3D %llu;\n", spaces, cache->uc_frees); - printf("%s uc_allocs =3D %llu;\n", spaces, cache->uc_allocs); + printf("%s uc_frees =3D %ju;\n", spaces, cache->uc_frees); + printf("%s uc_allocs =3D %ju;\n", spaces, cache->uc_allocs); =20 if (cache->uc_freebucket !=3D NULL) { ret =3D kread(kvm, cache->uc_freebucket, &ub, sizeof(ub), 0); @@ -412,20 +412,20 @@ main(int argc, char *argv[]) } printf(" Zone {\n"); printf(" uz_name =3D \"%s\";\n", name); - printf(" uz_allocs =3D %llu;\n", + printf(" uz_allocs =3D %ju;\n", uzp_userspace->uz_allocs); - printf(" uz_frees =3D %llu;\n", + printf(" uz_frees =3D %ju;\n", uzp_userspace->uz_frees); - printf(" uz_fails =3D %llu;\n", + printf(" uz_fails =3D %ju;\n", uzp_userspace->uz_fails); printf(" uz_fills =3D %u;\n", uzp_userspace->uz_fills); printf(" uz_count =3D %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", " "); =20 --=20 1.7.2.3 --MP_/V45ylbNW9Sv144uke8uKVXp-- --Sig_/j0IIO6G0OvbQXQCJQewu8.K Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iEYEARECAAYFAkyUsgkACgkQBYqIVf93VJ16SACfcwYSHrh0IoqMUFODzDrJ9RQZ 9voAoIqzNCiBLm9dpxXbGh0l8WHJEsg2 =MVkL -----END PGP SIGNATURE----- --Sig_/j0IIO6G0OvbQXQCJQewu8.K--