From owner-freebsd-questions@FreeBSD.ORG Tue Feb 8 22:23:36 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CA32416A4CE for ; Tue, 8 Feb 2005 22:23:36 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.199]) by mx1.FreeBSD.org (Postfix) with ESMTP id CE4B543D1D for ; Tue, 8 Feb 2005 22:23:34 +0000 (GMT) (envelope-from pergesu@gmail.com) Received: by wproxy.gmail.com with SMTP id 58so989125wri for ; Tue, 08 Feb 2005 14:23:34 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=T4uKsuAYEI90wNzyMYEZN/wi4HVxu8f2IbExSPSjG8kmzRL7LMLFWKUh+H57+OMMKA1XAVffGeOiXsRNJLYRoP+xd27QRcdOIBsC2L07hBX/uXJP8TRtf3Qo8M+MpiW8jqslwiqqcL0ZTTiGOQoANyP8mgUTLQ4VwkO4J7TPQrs= Received: by 10.54.2.55 with SMTP id 55mr41604wrb; Tue, 08 Feb 2005 14:23:34 -0800 (PST) Received: by 10.54.42.28 with HTTP; Tue, 8 Feb 2005 14:23:34 -0800 (PST) Message-ID: <810a540e05020814234873ad02@mail.gmail.com> Date: Tue, 8 Feb 2005 15:23:34 -0700 From: Pat Maddox To: Chuck Swiger In-Reply-To: <4209397F.6010204@mac.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <810a540e050208133310333144@mail.gmail.com> <20050208213612.GA29063@falcon.midgard.homeip.net> <4209397F.6010204@mac.com> cc: freebsd-questions@freebsd.org Subject: Re: Inactive memory X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Pat Maddox List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Feb 2005 22:23:36 -0000 Well Chuck, that must be a great answer, because I don't understand any of it :) I guess my only concern is that I have plenty of RAM available (1GB total, 520MB inactive usually), and wanted to make sure that it's not just a big memory leak. It's only been running for a couple days, so I was kind of scared that in a week it'd be something like 900 inactive and suddenly everything is coming out of swap. I'd just like to know that my machine is going to use the memory efficiently. Thanks for the response. (I think) it reassured me of what I need to know. On Tue, 08 Feb 2005 17:13:19 -0500, Chuck Swiger wrote: > 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 > >