Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 07 Mar 2012 10:49:13 +0000
From:      Luke Marsden <luke@hybrid-logic.co.uk>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        freebsd-fs@freebsd.org, team@hybrid-logic.co.uk
Subject:   Re: FreeBSD 8.2 - active plus inactive memory leak!?
Message-ID:  <1331117353.2589.88.camel@pow>
In-Reply-To: <20120307100557.GG75778@deviant.kiev.zoral.com.ua>
References:  <1331061203.2218.38.camel@pow> <4F569DFF.8040807@mac.com> <1331080581.2589.28.camel@pow> <20120307082338.GD75778@deviant.kiev.zoral.com.ua> <1331112366.2589.51.camel@pow> <20120307093109.GF75778@deviant.kiev.zoral.com.ua> <1331113988.2589.64.camel@pow> <20120307100557.GG75778@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 2012-03-07 at 12:05 +0200, Konstantin Belousov wrote:
> > I'm trying to explain 5GB+ of memory which has "gone missing" on this
> > system.  Active memory usage is currently at 13G (and inactive at 1G)
> > even though only the sum of the resident memory sizes in the output of
> > 'ps' comes only to 8557MB.
> > 
> > Can 5779M of memory be explained by 272011 vnodes entries?
> It can be explained why whatever count of vnodes. This is cached vnode
> pages.

Right, actual disk data pages associated with open files (vnodes) are
being cached in active/inactive memory?

So if I open a large file, read some data from it, and close it (the
refcount on the vnode reaches zero), and there is free memory on the
system, then those data pages will go both into the ARC cache (maybe)
and into cached vnode pages?  Or does the system only cache the vnode
pages if they are *not* cached in the ARC?

I understand that the vnode page cache and the ARC cache are contending
for system memory, is this correct?  But perhaps the vnode page cache is
better at evicting cache when the system starts seeing VM pressure?

I have limited the ARC cache, is there a way to limit how much
active/inactive memory is used for cached vnode pages?  (Why?  Because
the system is more stable when it has plenty of free memory, see
lists.freebsd.org/pipermail/freebsd-fs/2012-February/013775.html).

Or, do I not need to worry, because unlike the ARC cache, eviction of
cached vnode pages will occur before the system starts swapping/paging?

Cached vnode pages will never be swapped/paged to disk, right?  (This
seems that it would be foolish, because it would take just as long to
reconstruct the vnode from the data on disk as it would to page it back
in.)

If all of the above is correct is correct, then I can be confident that
even with low Free values of memory and large values of Active and Inact
due to cached vnode pages, that the system will be stable as long as it
has a limited ARC cache.  Right?

Thank you for your help!

> > > > Okay, so this could be UFS disk cache, except the system is ZFS-on-root
> > > > with no UFS filesystems active or mounted.  Can I confirm that no
> > > > double-caching of ZFS data is happening in active + inactive (+ cache)
> > > > memory?
> > > 
> > > ZFS double-buffers the mmaped files.
> > 
> > The only mmap on this system, to my knowledge, is done in Apache's
> > scoreboard, which is relatively small and doesn't explain the 5G
> > discrepancy.
> Any executed binary is mmaped, as well as shared libraries.

That should be okay, since the total size of the binaries and shared
libraries across the system is small compared to the amount of system
memory:

360M    /usr/jails/phpapache/usr/local/lib/
 41M    /usr/jails/phpapache/usr/local/bin/

And all application jails have nullfs mounts to this basejail, and so
are sharing the mmap'ed pages (I have confirmed this by
inspecting /proc/<pid>/map for processes running in two different
jails).

Thanks,
Luke

-- 
CTO, Hybrid Logic
+447791750420  |  +1-415-449-1165  | www.hybrid-cluster.com 





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