From owner-svn-src-all@FreeBSD.ORG Wed Oct 17 18:46:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 014B3C7; Wed, 17 Oct 2012 18:46:14 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id C50C18FC19; Wed, 17 Oct 2012 18:46:13 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 26C62B9A4; Wed, 17 Oct 2012 14:46:13 -0400 (EDT) From: John Baldwin To: Nikolay Denev Subject: Re: svn commit: r237656 - in head: contrib/top usr.bin/top Date: Wed, 17 Oct 2012 13:21:57 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p20; KDE/4.5.5; amd64; ; ) References: <201206271808.q5RI8m0d024853@svn.freebsd.org> <38E42006-48A5-4AF7-9892-EB81583FE5A9@gmail.com> In-Reply-To: <38E42006-48A5-4AF7-9892-EB81583FE5A9@gmail.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201210171321.57083.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 17 Oct 2012 14:46:13 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Oct 2012 18:46:14 -0000 On Wednesday, October 17, 2012 11:04:47 am Nikolay Denev wrote: > On Jun 27, 2012, at 9:08 PM, John Baldwin wrote: > > > Author: jhb > > Date: Wed Jun 27 18:08:48 2012 > > New Revision: 237656 > > URL: http://svn.freebsd.org/changeset/base/237656 > > > > Log: > > Add a new line to top that provides a brief summary of the ZFS ARC memory > > usage on hosts using ZFS. The new line displays the total amount of RAM > > used by the ARC along with the size of MFU, MRU, anonymous (in flight), > > headers, and other (miscellaneous) sub-categories. The line is not > > displayed on systems that are not using ZFS. > > > > Reviewed by: avg, fs@ > > MFC after: 3 days > > > > Modified: > > head/contrib/top/display.c > > head/contrib/top/layout.h > > head/contrib/top/machine.h > > head/contrib/top/top.c > > head/usr.bin/top/machine.c > > head/usr.bin/top/top.local.1 > > > > > > Modified: head/usr.bin/top/machine.c > > ============================================================================== > > --- head/usr.bin/top/machine.c Wed Jun 27 17:51:09 2012 (r237655) > > +++ head/usr.bin/top/machine.c Wed Jun 27 18:08:48 2012 (r237656) > > @@ -176,6 +176,12 @@ char *memorynames[] = { > > "K Free", NULL > > }; > > > > +int arc_stats[7]; > > +char *arcnames[] = { > > + "K Total, ", "K MRU, ", "K MFU, ", "K Anon, ", "K Header, ", "K Other", > > + NULL > > +}; > > + > > > > + if (arc_enabled) { > > + GETSYSCTL("kstat.zfs.misc.arcstats.size", arc_stat); > > + arc_stats[0] = arc_stat >> 10; > > + GETSYSCTL("vfs.zfs.mfu_size", arc_stat); > > + arc_stats[1] = arc_stat >> 10; > > + GETSYSCTL("vfs.zfs.mru_size", arc_stat); > > + arc_stats[2] = arc_stat >> 10; > > + GETSYSCTL("vfs.zfs.anon_size", arc_stat); > > + arc_stats[3] = arc_stat >> 10; > > + GETSYSCTL("kstat.zfs.misc.arcstats.hdr_size", arc_stat); > > + GETSYSCTL("kstat.zfs.misc.arcstats.l2_hdr_size", arc_stat2); > > + arc_stats[4] = arc_stat + arc_stat2 >> 10; > > + GETSYSCTL("kstat.zfs.misc.arcstats.other_size", arc_stat); > > + arc_stats[5] = arc_stat >> 10; > > + si->arc = arc_stats; > > + } > > + > > > Hi, > > It looks like MFU and MRU are swapped in top's display. > > I'm using this to correct the output: > > --- /usr/src/.zfs/snapshot/patches/usr.bin/top/machine.c 2012-09-26 08:20:26.000000000 +0200 > +++ usr.bin/top/machine.c 2012-10-17 17:00:14.988895167 +0200 > @@ -515,9 +515,9 @@ > if (arc_enabled) { > GETSYSCTL("kstat.zfs.misc.arcstats.size", arc_stat); > arc_stats[0] = arc_stat >> 10; > - GETSYSCTL("vfs.zfs.mfu_size", arc_stat); > - arc_stats[1] = arc_stat >> 10; > GETSYSCTL("vfs.zfs.mru_size", arc_stat); > + arc_stats[1] = arc_stat >> 10; > + GETSYSCTL("vfs.zfs.mfu_size", arc_stat); > arc_stats[2] = arc_stat >> 10; > GETSYSCTL("vfs.zfs.anon_size", arc_stat); > arc_stats[3] = arc_stat >> 10; Doh! Good catch! I think I'd rather swap the display order so MFU is listed before MRU (alphabetical order). -- John Baldwin