Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Oct 2011 15:28:56 +0200
From:      Ivan Voras <ivoras@freebsd.org>
To:        Doug Barton <dougb@freebsd.org>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: dirhash and dynamic memory allocation
Message-ID:  <CAF-QHFUp6sX-JG%2B6N8WGUN2_taS%2BK4y1-F8Vs5CS6kOi=rx5Uw@mail.gmail.com>
In-Reply-To: <4EA2277B.5080306@FreeBSD.org>
References:  <4E97FEDD.7060205@quip.cz> <j7938v$66s$1@dough.gmane.org> <4EA19203.5050503@quip.cz> <4EA2277B.5080306@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 22 October 2011 04:16, Doug Barton <dougb@freebsd.org> wrote:
> On 10/21/2011 08:38, Miroslav Lachman wrote:

>> will be allways between these two limits?
>
> Isn't that what vfs.ufs.dirhash_minsize is for? I think given that there
> is a lot more memory in modern systems setting that higher by default is
> probably a good idea. Or maybe I'm misunderstanding what that knob does?

Directories are AFAIK cached "all or nothing" so if there are some
large directories in the dirhash and they are evicted, it's possible
to end up with "0" dirhash used without being able to fit a directory
in the dirhash_minsize for any reasonable amount of time.
>>> AFAIK I've changed it to autotune so it's configured to approximately 4
>>> MB on a 4 GB machine (and scales up) in 9.
>>
>> I didn't tried 9 yet. Does it mean dirhash_maxmem is initially set to
>> approximately 1% of physical RAM and then it can be set higher by sysctl
>> as in older versions?
>
> I'm not sure that's what's happening, I have 6G of ram in this box and I
> have this by default:
>
> vfs.ufs.dirhash_maxmem: 9977856

It's actually not a direct percentage of memory but it's tied to
hibufspace which is itself auto-tuned here:
http://fxr.watson.org/fxr/source/kern/vfs_bio.c?v=FREEBSD8#L606 . So
yes, it's nonlinear (and it probably doesn't matter).



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAF-QHFUp6sX-JG%2B6N8WGUN2_taS%2BK4y1-F8Vs5CS6kOi=rx5Uw>