Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Oct 2010 21:46:23 +0000 (UTC)
From:      Ivan Voras <ivoras@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r214359 - head/sys/ufs/ufs
Message-ID:  <201010252146.o9PLkNNu078104@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



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