dirhash and dynamic memory allocation

Ivan Voras ivoras at freebsd.org
Sat Oct 22 13:29:37 UTC 2011


On 22 October 2011 04:16, Doug Barton <dougb at 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).


More information about the freebsd-fs mailing list