From owner-freebsd-hackers@FreeBSD.ORG Thu Dec 26 16:38:14 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 170723BF; Thu, 26 Dec 2013 16:38:13 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C2B831EFD; Thu, 26 Dec 2013 16:38:13 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id ABF64B986; Thu, 26 Dec 2013 11:38:12 -0500 (EST) From: John Baldwin To: freebsd-hackers@freebsd.org Subject: Re: vmstat buckets Date: Thu, 26 Dec 2013 11:28:03 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20130906; KDE/4.5.5; amd64; ; ) References: <4260012E-9911-47AB-88B9-FDCD6748E6EE@fivenynes.com> In-Reply-To: <4260012E-9911-47AB-88B9-FDCD6748E6EE@fivenynes.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable Message-Id: <201312261128.03527.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 26 Dec 2013 11:38:12 -0500 (EST) Cc: "freebsd-net@freebsd.org" , Mark van der Meulen X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Dec 2013 16:38:14 -0000 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