From owner-freebsd-questions@FreeBSD.ORG Wed Sep 2 15:13:56 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 A72601065692 for ; Wed, 2 Sep 2009 15:13:56 +0000 (UTC) (envelope-from peo@intersonic.se) Received: from neonpark.inter-sonic.com (neonpark.inter-sonic.com [212.247.8.98]) by mx1.freebsd.org (Postfix) with ESMTP id 661588FC0A for ; Wed, 2 Sep 2009 15:13:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at BSDLabs AB Message-ID: <4A9E8BB0.1020107@intersonic.se> Date: Wed, 02 Sep 2009 17:13:52 +0200 From: Per olof Ljungmark User-Agent: Thunderbird 2.0.0.21 (X11/20090411) MIME-Version: 1.0 To: Mel Flynn References: <4A9D8057.8020307@intersonic.se> <4A9D89CB.6060206@intersonic.se> <4A9D8FDB.9040908@prgmr.com> <200909021624.38655.mel.flynn+fbsd.questions@mailing.thruhere.net> In-Reply-To: <200909021624.38655.mel.flynn+fbsd.questions@mailing.thruhere.net> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org, Michael David Crawford Subject: Re: memory usage displsy 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: Wed, 02 Sep 2009 15:13:56 -0000 Mel Flynn wrote: > On Tuesday 01 September 2009 23:19:23 Michael David Crawford wrote: >> Per olof Ljungmark wrote: >>> Well, my problem is that if I add up all I *can* see in top or ps it >>> never gets near the by now 3G plus memory shown as "Active". Maybe one >>> gig is accounted for, >> I'm not that familiar with FreeBSD yet, but the kernel uses memory which >> might not be charged against any process. >> >> For example, to map some virtual memory requires memory to store the >> mappings in. >> >> Open files have kernel structures, as do filesystems. >> >> If top or ps were only to show userspace memory allocations, then you're >> right, a lot of memory would be unaccounted for. > > It doesn't for the Active to Free states. For individual processes, everything > is shown that the process allocates. So for a file descriptor, an int would be > allocated, where the kernel holds the real info. > > This is one cause for filled Active memory: a process polling multiple file > descriptors, like a File Alteration Monitor under current desktops. > > The other, as Dan Nelson described, is file cache. If you want to be sure it's > this, then reboot the machine and run: > /etc/periodic/security/100.chksetuid > > You should see memory usage going up. If this causes a performance problem > (i.e. You sometimes are subject to heavily increasing loads on a mailserver, > that causes a lot of forks and file cache memory isn't unloaded fast enough), > then you should either disable the security check or properly seperate data > from binaries using partitions and mount data partitions with nosuid/noexec, > so that these are omitted from the daily checks. Thank you all for the informative answers, helped a lot to understand better what is going on. I cannot run 100.chksetuid on a production server but I will definitely do it on the testing one. Cheers, -- per