Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Jun 2010 17:14:28 -0700
From:      Artem Belevich <fbsdlist@src.cx>
To:        Peter Jeremy <peterjeremy@acm.org>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: ZFS memory usage
Message-ID:  <AANLkTin1GV0ayjtsvF5NTQZK37-kVq1KOlFEkHFiywa-@mail.gmail.com>
In-Reply-To: <20100607232909.GA57423@server.vk2pj.dyndns.org>
References:  <20100607232909.GA57423@server.vk2pj.dyndns.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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@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. =A0Over 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. =A0Is 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? =A0The perl hack:
> =A0perl -e '$x =3D "x" x 1000000;'
> sort-of works - by forcing the VM system into real memory shortage.
> Is there a better work-around?
>
> --
> Peter Jeremy
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTin1GV0ayjtsvF5NTQZK37-kVq1KOlFEkHFiywa->