ZFS memory usage

Artem Belevich fbsdlist at src.cx
Tue Jun 8 00:14:29 UTC 2010


I believe it's pagedaemon's job to push pages from active list to
inactive and from inactive down to cache and free.
I have a really ugly hack to arc.c which forces pagedaemon wakeup if
ARC sees too much memory on inactive list.
How much is too much is defined by a sysctl value.

http://pastebin.com/ZCkzkWcs

Be warned: it's ugly, it may not work, it assumes too much, it's plain
broken, it may <write in your worst nightmare details here>...
I'm serious -- I have seen my box locking up when I did manage to
exhaust memory. The only reason I'm posting this ugliness at all is
bacause of hope that someone more familiar with memory allocation in
FreeBSD may be able to suggest better approach.

--Artem



On Mon, Jun 7, 2010 at 4:29 PM, Peter Jeremy <peterjeremy at acm.org> wrote:
> Currently, ZFS does not appear to be able to steal memory from the
> "inactive" list, whereas NFS and UFS both return "freed" pages to the
> "inactive" list.  Over time, unless you have a pure ZFS box (with no
> NFS), this tends to result in ZFS reporting a memory shortage
> (kstat.zfs.misc.arcstats.memory_throttle_count increasing), whilst
> there is plenty of "inactive" space.
>
> What is involved in correcting this?
>
> At least part of the problem is that
> cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c:arc_memory_throttle()
> only looks at cnt.v_free_count (number of free pages) when deciding
> whether to throttle or not.  Is the fix as simple as changing the
> test to check (cnt.v_free_count + cnt.v_inactive_count)?
>
> Assuming that the fix is non-trivial, is there an easy way to transfer
> "inactive" memory to the "free" list?  The perl hack:
>  perl -e '$x = "x" x 1000000;'
> sort-of works - by forcing the VM system into real memory shortage.
> Is there a better work-around?
>
> --
> Peter Jeremy
>


More information about the freebsd-fs mailing list