dirhash and dynamic memory allocation

Miroslav Lachman 000.fbsd at quip.cz
Fri Oct 14 19:00:03 UTC 2011


b. f. wrote:
> Miroslav Lachman wrote:

[...]

>> I didn't mean real doc (man page or handbook), but just some official
>> place (release notes?) stating the change of the dirhash behavior.
>
>> From the page you cited:
>
> "Get code in a state suitable for being committed to -CURRENT. Done
> ...
> (2009-7-7) I committed the dirhash vm_lowmem handler to -CURRENT about
> a month ago, and it will be included in 8.0-RELEASE. Also I plan to
> commit a backport of these changes to 7-STABLE, probably around
> September."

OK, I overlookd this sentence that it is already committed

>> From http://www.FreeBSD.org/releases/7.3R/relnotes-detailed.html :
>
> "UFS_DIRHASH (enabled by default) now supports removing the cache data
> when the system memory is low (via vm_lowmem event handler). A bug
> that the system caused a panic when decreasing a sysctl variable
> vfs.ufs.dirhash_maxmem below the current amount of memory used by
> UFS_DIRHASH, has been fixed."

This message sounds like bug fix message to me (I am not native english 
speaker, so it is rather my problem, and you are right, that it was 
documented)

> In the commit logs:
>
> http://svnweb.FreeBSD.org/base/head/sys/ufs/ufs/ufs_dirhash.c?view=log
>
> So the changes have been documented.  Perhaps not in exhaustive
> detail, but enough to provide a basis for further inquiry.  And as
> someone pointed out, there are the suggestively-named OIDs, and their
> descriptions.

The OIDs and their description... well, max, min etc. is suggestive, but 
I was not sure about "lowmemcount"
 > sysctl -d vfs.ufs.dirhash_lowmemcount
vfs.ufs.dirhash_lowmemcount: number of times low memory hook called

Was it meant as "number of times, where dirhash_mem is equal to 
dirhash_maxmem and new entries cannot be added" ... or rather "number of 
times the system was low on free memory, so some dirhash entries were 
removed and some dirhash memory freed"? I initially thought the first, 
but now I think the second.

Thank you for your detailed explanation and links. Shame on me!
(this week was hard in work... and it's friday)

Miroslav Lachman


More information about the freebsd-fs mailing list