Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Oct 2012 13:21:57 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Nikolay Denev <ndenev@gmail.com>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r237656 - in head: contrib/top usr.bin/top
Message-ID:  <201210171321.57083.jhb@freebsd.org>
In-Reply-To: <38E42006-48A5-4AF7-9892-EB81583FE5A9@gmail.com>
References:  <201206271808.q5RI8m0d024853@svn.freebsd.org> <38E42006-48A5-4AF7-9892-EB81583FE5A9@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday, October 17, 2012 11:04:47 am Nikolay Denev wrote:
> On Jun 27, 2012, at 9:08 PM, John Baldwin <jhb@freebsd.org> 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



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