Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 08 Feb 2005 17:13:19 -0500
From:      Chuck Swiger <cswiger@mac.com>
To:        Pat Maddox <pergesu@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Inactive memory
Message-ID:  <4209397F.6010204@mac.com>
In-Reply-To: <810a540e050208134479b4e774@mail.gmail.com>
References:  <810a540e050208133310333144@mail.gmail.com> <20050208213612.GA29063@falcon.midgard.homeip.net> <810a540e050208134479b4e774@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Pat Maddox wrote:
> Alright, that lets me know that it's not an entirely bad thing.  It
> does say, however, that it's fine as long as the free memory isn't
> REALLY low.  It did get down to 13MB though, as I said.

Really low means less than 1 MB.  That would indicate the VM system is under 
so much pressure that it can't maintain the minimum amount of free space it 
wants to have:

vm.v_free_min: 378
vm.v_free_target: 1655
vm.v_free_reserved: 143
vm.v_pageout_free_min: 34
vm.v_free_severe: 260

These numbers are likely to be in 4K pages, 260 * 4K = 1040K ~= 1 MB, and will 
vary slighty depending on available physical RAM, kernel size, and probably 
the phase of the moon.  :-)

> So now I understand that it's alright for the free memory to be low. 
> I don't understand how the inactive, cache, and buffered memory are
> used though.  When a process uses up all the free memory, does it then
> use some from inactive, or does it use swap?

A process will start reusing inactive memory, which involves flushing data to 
disk and/or using swap, depending, but the VM system may well swap out pages 
from other processes instead (especially ones that have been idle for a long 
time).

[ The VM pager uses LRU or actually NFU page selection algorithms with complex 
names like "second chance replacement via clock hand sweep, with working set 
size and global page-fault frequency modelling". :-)  This is a complicated 
topic, and it starts becoming better to look at the code than to try to 
describe the algorithms in words. ]

-- 
-Chuck



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