svn commit: r214359 - head/sys/ufs/ufs
Ivan Voras
ivoras at FreeBSD.org
Mon Oct 25 21:46:23 UTC 2010
Author: ivoras
Date: Mon Oct 25 21:46:23 2010
New Revision: 214359
URL: http://svn.freebsd.org/changeset/base/214359
Log:
Bring vfs.ufs.dirhash_maxmem into the age of the fruitbat and make it
autotuned. It is only an upper bound (the memory is not always allocated)
and the system contains a vm_lowmem handler so nothing will crash and burn
if it's tuned too high.
Reviewed by: mckusick
Modified:
head/sys/ufs/ufs/ufs_dirhash.c
Modified: head/sys/ufs/ufs/ufs_dirhash.c
==============================================================================
--- head/sys/ufs/ufs/ufs_dirhash.c Mon Oct 25 20:52:33 2010 (r214358)
+++ head/sys/ufs/ufs/ufs_dirhash.c Mon Oct 25 21:46:23 2010 (r214359)
@@ -72,7 +72,8 @@ static int ufs_mindirhashsize = DIRBLKSI
SYSCTL_INT(_vfs_ufs, OID_AUTO, dirhash_minsize, CTLFLAG_RW,
&ufs_mindirhashsize,
0, "minimum directory size in bytes for which to use hashed lookup");
-static int ufs_dirhashmaxmem = 2 * 1024 * 1024;
+static int ufs_dirhashmaxmem = 2 * 1024 * 1024; /* NOTE: initial value. It is
+ tuned in ufsdirhash_init() */
SYSCTL_INT(_vfs_ufs, OID_AUTO, dirhash_maxmem, CTLFLAG_RW, &ufs_dirhashmaxmem,
0, "maximum allowed dirhash memory usage");
static int ufs_dirhashmem;
@@ -1290,6 +1291,9 @@ ufsdirhash_lowmem()
void
ufsdirhash_init()
{
+ ufs_dirhashmaxmem = lmax(roundup(hibufspace / 64, PAGE_SIZE),
+ 2 * 1024 * 1024);
+
ufsdirhash_zone = uma_zcreate("DIRHASH", DH_NBLKOFF * sizeof(doff_t),
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
mtx_init(&ufsdirhash_mtx, "dirhash list", NULL, MTX_DEF);
More information about the svn-src-head
mailing list