Date: Mon, 31 Dec 2007 23:23:19 +0000 From: David Taylor <davidt@yadt.co.uk> To: freebsd-fs@freebsd.org Cc: pjd@freebsd.org Subject: [PATCH] ZFS not caching on i386 with kmem_size >1GB Message-ID: <20071231232319.GA90972@outcold.yadt.co.uk>
next in thread | raw e-mail | index | archive | help
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. -- David Taylor
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071231232319.GA90972>