vm_lowmem event handler for dirhash

From: Nick Barkas <snb_at_freebsd.org>
Date: Wed, 27 May 2009 12:36:49 +0200
I sent this out to fs_at_ last night, but it was suggested that I send it
here for more eyes and potential testers.

Hello
Some time during the next week or so, I plan on committing the attached
patch. It adds a vm_lowmem event handler to the dirhash code in UFS2 so
that dirhashes will be deleted when the system is low on memory. This
allows one to increase the maximum amount of memory available for
dirhash on machines that have memory to spare (via the
vfs.ufs.dirhash_maxmem sysctl), and hopefully just improving behaviour
in low memory situations. I worked on this last year for the summer of
code with David Malone as my mentor.

This patch adds a couple sysctls. vfs.ufs.dirhash_reclaimage is the
number of seconds a dirhash can be unused before it will unconditionally
be destroyed if a vm_lowmem event is invoked. It defaults to 5 (seconds)
for now. If that doesn't free up more than 10% of used dirhash memory,
newer dirhashes will be deleted as well. vfs.ufs.dirhash_lowmemcount
just shows how many vm_lowmem events have been invoked.
vfs.ufs.dirhash_maxmem has been kept at the default of 2MB for now, but
it can of course be increased. In the future, I might look into setting
the default to a higher number on machines with lots of memory.

Feedback welcome!

Nick

Received on Wed May 27 2009 - 08:36:51 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:48 UTC