Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 02 Jan 2008 12:09:45 +0100
From:      Kris Kennaway <kris@FreeBSD.org>
To:        David Taylor <davidt@yadt.co.uk>, freebsd-fs@freebsd.org, pjd@freebsd.org
Subject:   Re: [PATCH] ZFS not caching on i386 with kmem_size >1GB
Message-ID:  <477B70F9.8070903@FreeBSD.org>
In-Reply-To: <20071231232319.GA90972@outcold.yadt.co.uk>
References:  <20071231232319.GA90972@outcold.yadt.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
David Taylor wrote:
> Hi,
> 
> About 2 months ago I reported that I found ZFS extremely slow for
> some tasks (specifically upgrading ports).  This was because ZFS
> was only using the absolute minimum cache size at all times.
> 
> The problem is here in /sys/contrib/opensolaris/uts/common/fs/zfs/arc.c:
> 
> static int
> arc_reclaim_needed(void)
> {
> ...
>         if (kmem_used() > (kmem_size() * 4) / 5)
>                 return (1);
> }
> 
> I'm running on i386 with kmem_size set to 1GB.  As a result, the
> multiplication overflows and the test becomes (kmem_used() > 0).  ZFS then
> always tries to shrink the cache, and never grows it above the absolute
> minimum size (about 30MB for each of c and p)
> 
> The patch I have attached fixes the problem for me, although there is probably
> a better way to avoid the overflow (without calling kmem_size() twice).
> Best of all, portupgrade is now an order of magnitude faster!
> 
> Of course, I'm now worried that my previously rock-solid settings will actually
> trigger the kmem_map too small panics when the cache actually fills up.
> 

FYI, kmem_size > 1GB makes no sense unless you also increase KVA_PAGES 
since the entire kernel only has 1GB of address space on i386.

Kris



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