From owner-freebsd-questions@FreeBSD.ORG Sat Jan 17 18:09:20 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 766E31065721 for ; Sat, 17 Jan 2009 18:09:20 +0000 (UTC) (envelope-from timothyk@wallnet.com) Received: from mho-01-bos.mailhop.org (mho-01-bos.mailhop.org [63.208.196.178]) by mx1.freebsd.org (Postfix) with ESMTP id 39E558FC12 for ; Sat, 17 Jan 2009 18:09:20 +0000 (UTC) (envelope-from timothyk@wallnet.com) Received: from ool-18bb798e.dyn.optonline.net ([24.187.121.142] helo=www.smsd.tv) by mho-01-bos.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1LOEze-000KkZ-LR; Sat, 17 Jan 2009 17:30:02 +0000 Received: from tim-kellerss-macbook-pro.local ([10.0.1.3]) by www.smsd.tv (8.14.3/8.14.3) with ESMTP id n0HHTqb7009942; Sat, 17 Jan 2009 12:29:52 -0500 (EST) (envelope-from timothyk@wallnet.com) X-Mail-Handler: MailHop Outbound by DynDNS X-Originating-IP: 24.187.121.142 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/mailhop/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX19eIfILnUWQMrNucIcd5NGOfDlcD5ZxJvE= Message-ID: <4972158B.4030806@wallnet.com> Date: Sat, 17 Jan 2009 12:29:47 -0500 From: Tim Kellers User-Agent: Thunderbird 2.0.0.19 (Macintosh/20081209) MIME-Version: 1.0 To: David Scheidt References: <4970C565.1000304@njit.edu> <20090116222249.S10333@wojtek.tensor.gdynia.pl> <20090117012519.71feb293@gumby.homeunix.com> <20090117021409.GA3730@panix.com> In-Reply-To: <20090117021409.GA3730@panix.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0.1 (www.smsd.tv [24.187.121.142]); Sat, 17 Jan 2009 12:29:53 -0500 (EST) Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: RW , freebsd-questions@freebsd.org Subject: Re: RAM/Memory resources on 7 STABLE X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jan 2009 18:09:20 -0000 David Scheidt wrote: > On Sat, Jan 17, 2009 at 01:25:19AM +0000, RW wrote: > >> On Fri, 16 Jan 2009 22:23:06 +0100 (CET) >> Wojciech Puchar wrote: >> >> >>>> When I boot this machine it usually shows (in top) about 11 G Free >>>> in the Mem: line >>>> >>>> The machine, in this snippet, has been up for 5 days 22 hours and >>>> change and it now shows 1436M free in the Mem: line >>>> I've been watching the number and it has been slowly decreasing >>>> over the 5 days since its last boot. It looks like as the Free >>>> line trends down, the Inact value trends up to keep the total Mem >>>> used at the installed 12G >>>> >>> ALL unused memory is used as disk cache in FreeBSD. >>> >> Although, looking at the output of top, most of the memory is in the >> inactive state. As I understand it cache pages go from active to >> cached, and the inactive queue contains pages that need to be written >> out to swap before they can be reused. >> > > No. It just means they're not active -- nothing has touched them > "recently". They may be dirty. They may not be. Recently means the > last 20 seconds to a minute, depending. > > > >> The very high level of inactive memory looks suspiciously like a >> memory-leak to me. Hopefully someone who knows more about this will >> step in - don't take my word for it. >> > > I have no data on the system in question, but it's very common for a > machine to have large amounts of inactive memory, particularly one > that's not under any sort of memory pressure. > > My basically idle workstation has 1.5 GB of memory, 5 MB free, and over > a gig inactive. Since I'm not doing anything with it (I'm writing this > from another machine), and its just hanging out, this is what I'd expect. > Should it do something that requires memory, the pager will toss clean > inactive pages to the free list, and they'll be reused. Of course, if > what they're required for is something they already have in them (like > the code segments of "recently" terminated application that's > restarted), they'll get reused, saving having to read them from disk. > The only time you'll large amounts of memory on the Free list is when > a machine is first booted and hasn't touched that memory for anything, > or when an application that's got a large dyanmically allocated block > of memory terminates. The rest of the time, the free list should be > small. > > If the machine isn't swapping, there's usually nothing to worry about. > > For comparison's sake here is the top -P output from my Dell 2950 dual quad core server; this one is has 8 GB or RAM installed last pid: 94403; load averages: 0.02, 0.38, 0.63 up 11+21:13:56 12:12:47 69 processes: 1 running, 68 sleeping CPU 0: 0.0% user, 0.0% nice, 0.0% system, 0.0% interrupt, 100% idle CPU 1: 0.0% user, 0.0% nice, 0.0% system, 0.0% interrupt, 100% idle CPU 2: 0.0% user, 0.0% nice, 0.0% system, 0.0% interrupt, 100% idle CPU 3: 0.0% user, 0.0% nice, 0.0% system, 0.0% interrupt, 100% idle CPU 4: 0.0% user, 0.0% nice, 0.0% system, 0.0% interrupt, 100% idle CPU 5: 0.0% user, 0.0% nice, 0.0% system, 0.0% interrupt, 100% idle CPU 6: 0.0% user, 0.0% nice, 0.0% system, 0.0% interrupt, 100% idle CPU 7: 0.0% user, 0.0% nice, 0.0% system, 0.0% interrupt, 100% idle Mem: 226M Active, 2683M Inact, 465M Wired, 552K Cache, 214M Buf, 4537M Free Swap: 16G Total, 16G Free > uname -a FreeBSD dl 7.1-STABLE FreeBSD 7.1-STABLE #7: Mon Jan 5 13:53:52 EST 2009 root@dl:/usr/obj/usr/src/sys/AMD amd64 And here is the top -P from my Dell 2850 dual core server with 12 GB RAM installed: last pid: 9877; load averages: 0.07, 0.04, 0.07 up 6+22:31:45 12:20:13 98 processes: 1 running, 97 sleeping CPU 0: 0.0% user, 0.0% nice, 0.0% system, 0.0% interrupt, 100% idle CPU 1: 0.0% user, 0.0% nice, 1.5% system, 0.0% interrupt, 98.5% idle CPU 2: 0.4% user, 0.0% nice, 0.0% system, 0.0% interrupt, 99.6% idle CPU 3: 0.0% user, 0.0% nice, 0.0% system, 0.0% interrupt, 100% idle Mem: 242M Active, 10G Inact, 431M Wired, 128M Cache, 214M Buf, 943M Free Swap: 2014M Total, 2014M Free FreeBSD www 7.1-STABLE FreeBSD 7.1-STABLE #2: Tue Jan 6 19:24:57 EST 2009 root@www:/usr/obj/usr/src/sys/DELL64 amd64 Both of these machines are running nearly identical software; the main difference is that the 2950 quad core is also running Samba. I can see the numbers move up and down between Free and Inactive on the 2950, but the 2850 just continues to have Free in decline; it now shows 10G inactive. When I stop and restart apache, MySQL and Mailman on the 2850, I can see an small increase in the Free and a decrease in inactive. As far as I know, neither machine has ever gone into swap. The 2850 has only 2 G of swap space because originally the machine only had 1 G of RAM. I don't know what the Free vs Inactive numbers were on that box back then. I just never noticed the numbers. Again, I don't know that there is any problem at all, I'm just trying to understand why the 2 machines would have such different amounts of Inactive and Free memory. Tim