Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Sep 2010 14:35:16 +0200
From:      Fabian Keil <freebsd-listen@fabiankeil.de>
To:        Robert Watson <rwatson@FreeBSD.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: zfs + uma
Message-ID:  <20100918143516.3568f40e@r500.local>
In-Reply-To: <alpine.BSF.2.00.1009181221560.86826@fledge.watson.org>
References:  <4C93236B.4050906@freebsd.org> <4C935F56.4030903@freebsd.org> <alpine.BSF.2.00.1009181221560.86826@fledge.watson.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--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 <rwatson@FreeBSD.org> 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 <fk@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 *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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100918143516.3568f40e>