Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Apr 2010 09:04:36 -0400
From:      jhell <jhell@dataix.net>
To:        Andriy Gapon <avg@icyb.net.ua>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: some arc_reclaim_needed stats
Message-ID:  <4BCEF7E4.6080606@dataix.net>
In-Reply-To: <4BC86CF3.7060708@icyb.net.ua>
References:  <4BC86CF3.7060708@icyb.net.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On 04/16/2010 09:58, Andriy Gapon wrote:
> 
> I added some statistics gathering code to arc_reclaim_needed (see a diff below)
> and got these results:
> 
> vfs.zfs.arc_reclaim_kmem_used: 192
> vfs.zfs.arc_reclaim_paging_target: 72505
> vfs.zfs.arc_reclaim_pages_needed: 17
> vfs.zfs.arc_reclaim_arc_c_max: 150
> vfs.zfs.arc_reclaim_needfree: 1693
> 
> Are these numbers useful in any way? :-)
> What do they tell?
> Perhaps vm_paging_target() check is a bit too aggressive?
> 
> Thanks!
> 
> 
> diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
> b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
> index ca8ffb1..6db69e1 100644
> --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
> +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
> @@ -2040,6 +2040,24 @@ arc_shrink(void)
> 
>  static int needfree = 0;
> 
> +static int arc_reclaim_needfree = 0;
> +static int arc_reclaim_arc_c_max = 0;
> +static int arc_reclaim_pages_needed = 0;
> +static int arc_reclaim_paging_target = 0;
> +static int arc_reclaim_kmem_used = 0;
> +
> +SYSCTL_INT(_vfs_zfs, OID_AUTO, arc_reclaim_needfree, CTLFLAG_RD,
> +    &arc_reclaim_needfree, 0, "Later");
> +SYSCTL_INT(_vfs_zfs, OID_AUTO, arc_reclaim_arc_c_max, CTLFLAG_RD,
> +    &arc_reclaim_arc_c_max, 0, "Later");
> +SYSCTL_INT(_vfs_zfs, OID_AUTO, arc_reclaim_pages_needed, CTLFLAG_RD,
> +    &arc_reclaim_pages_needed, 0, "Later");
> +SYSCTL_INT(_vfs_zfs, OID_AUTO, arc_reclaim_paging_target, CTLFLAG_RD,
> +    &arc_reclaim_paging_target, 0, "Later");
> +SYSCTL_INT(_vfs_zfs, OID_AUTO, arc_reclaim_kmem_used, CTLFLAG_RD,
> +    &arc_reclaim_kmem_used, 0, "Later");
> +
> +/* XXX AVG ZFS BOOKMARK */
>  static int
>  arc_reclaim_needed(void)
>  {
> @@ -2048,10 +2066,14 @@ arc_reclaim_needed(void)
>  #endif
> 
>  #ifdef _KERNEL
> -	if (needfree)
> +	if (needfree) {
> +		arc_reclaim_needfree++;
>  		return (1);
> -	if (arc_size > arc_c_max)
> +	}
> +	if (arc_size > arc_c_max) {
> +		arc_reclaim_arc_c_max++;
>  		return (1);
> +	}
>  	if (arc_size <= arc_c_min)
>  		return (0);
> 
> @@ -2059,8 +2081,14 @@ arc_reclaim_needed(void)
>  	 * If pages are needed or we're within 2048 pages
>  	 * of needing to page need to reclaim
>  	 */
> -	if (vm_pages_needed || (vm_paging_target() > -2048))
> +	if (vm_pages_needed) {
> +		arc_reclaim_pages_needed++;
> +		return (1);
> +	}
> +	if ((vm_paging_target() > -2048)) {
> +		arc_reclaim_paging_target++;
>  		return (1);
> +	}
> 
>  #if 0
>  	/*
> @@ -2105,8 +2133,10 @@ arc_reclaim_needed(void)
>  		return (1);
>  #endif
>  #else
> -	if (kmem_used() > (kmem_size() * 3) / 4)
> +	if (kmem_used() > (kmem_size() * 3) / 4) {
> +		arc_reclaim_kmem_used++;
>  		return (1);
> +	}
>  #endif
> 
>  #else
> 

Hi Andriy,

If these are not tunable values and serve a good purpose as a stat to be
added at some point, would they not be better in kstat.zfs.misc? rather
than vfs.zfs so they can be collected with the rest of the stats via
arc_summary.pl.

Without seeing the thread "kstat.zfs.misc.arcstats.hash_collisions" I
had updated the arc_summary.pl script yesterday to include these under a
"ARC Misc" section in the output. Just a FYI in case it may be useful to
you or others.

Thanks

PS: Not a must, but anything that is ZFS (k)stats related I would
appreciate greatly being CC'd so I can properly track the improvements
and adjust the arc_summary.pl script appropriately.

Regards,

-- 

 http://jhell.googlecode.com/files/arc_summary.pl (r59)

 jhell



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