summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authorivoras <ivoras@FreeBSD.org>2010-10-25 21:46:23 +0000
committerivoras <ivoras@FreeBSD.org>2010-10-25 21:46:23 +0000
commit4dfcef74e1114e7c367d8f3f09ae8c847f597a15 (patch)
treebd94b38547c9218e1e0a61547e072f2f5d94f16e /sys/ufs
parent4b2c6a01ba3a239ef6074caea4e39a610c600cbe (diff)
downloadFreeBSD-src-4dfcef74e1114e7c367d8f3f09ae8c847f597a15.zip
FreeBSD-src-4dfcef74e1114e7c367d8f3f09ae8c847f597a15.tar.gz
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
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ufs/ufs_dirhash.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/ufs/ufs/ufs_dirhash.c b/sys/ufs/ufs/ufs_dirhash.c
index d7c1d0d..9c89689 100644
--- a/sys/ufs/ufs/ufs_dirhash.c
+++ b/sys/ufs/ufs/ufs_dirhash.c
@@ -72,7 +72,8 @@ static int ufs_mindirhashsize = DIRBLKSIZ * 5;
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);
OpenPOWER on IntegriCloud