Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Dec 2013 11:28:03 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>, Mark van der Meulen <mark@fivenynes.com>
Subject:   Re: vmstat buckets
Message-ID:  <201312261128.03527.jhb@freebsd.org>
In-Reply-To: <4260012E-9911-47AB-88B9-FDCD6748E6EE@fivenynes.com>
References:  <4260012E-9911-47AB-88B9-FDCD6748E6EE@fivenynes.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday, December 25, 2013 6:02:42 am Mark van der Meulen wrote:
> Hi All,
>=20
> I have question about buckets in vmstat -z output which I haven=92t been =
able=20
to find an answer for online=85
>=20
> I have 6 FreeBSD 9 boxes running as routers and they are seeing varying=20
results in vmstat -z. I=92m interested in understanding what the Buckets=20
represent/mean and how I can influence usage of them.
>=20
> Some of the routers show 0 free buckets under 64 or 128 Bucket and so I d=
id=20
some research and haven=92t been able to find out what it means - most peop=
le=20
who have asked online have received an answer that it is nothing to worry=20
about, which is meaningless to me.
>=20
> It seems that the higher the usage of the router, especially when it is a=
lso=20
running userspace applications the less Bucket availability there is. Also =
I=20
found someone speculating it was related to free kernel memory so that was=
=20
updated on some routers however I saw little difference(although not sure i=
f=20
adding it in /etc/sysctl.conf actually does anything as some haven=92t had =
the=20
vm.kmem_size value change at all, despite reboots).
>=20
> Can anyone explain what the buckets (16,32,64,128) do and what they=20
represent? Also if you know anything about troubleshooting bucket failures?=
=20
There doesn=92t appear to be anything useful online despite many searches.
>=20
> I am aware that it may not have anything to do with the problems I am=20
seeing, but I would still like to understand.

They are used to back malloc(9).  The in-kernel malloc(2) rounds allocations
smaller than a page up to the next power of two and then allocates that from
a UMA zone for that power of two.  For example, the '128' bucket is used fo=
r=20
all calls to malloc(9) for a size between 65 and 128.

vmstat -m can give you a sense of which buckets each malloc type uses, but
it doesn't give you a very detailed breakdown.  However, if you compare
snapshots of vmstat -m taken along with your vmstat -z snapshots, you might
be able to infer which malloc buckets are seeing activity and use that to s=
ee
which malloc types correspond to the stats you care about from vmstat -z.

=2D-=20
John Baldwin



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