From owner-freebsd-questions@FreeBSD.ORG Wed Sep 2 14:24:42 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 7C278106566C for ; Wed, 2 Sep 2009 14:24:42 +0000 (UTC) (envelope-from mel.flynn+fbsd.questions@mailing.thruhere.net) Received: from mailhub.rachie.is-a-geek.net (rachie.is-a-geek.net [66.230.99.27]) by mx1.freebsd.org (Postfix) with ESMTP id 496028FC15 for ; Wed, 2 Sep 2009 14:24:42 +0000 (UTC) Received: from smoochies.rachie.is-a-geek.net (mailhub.lan.rachie.is-a-geek.net [192.168.2.11]) by mailhub.rachie.is-a-geek.net (Postfix) with ESMTP id 9D5BA7E821; Wed, 2 Sep 2009 06:24:52 -0800 (AKDT) From: Mel Flynn To: freebsd-questions@freebsd.org Date: Wed, 2 Sep 2009 16:24:37 +0200 User-Agent: KMail/1.11.4 (FreeBSD/8.0-BETA2; KDE/4.2.4; i386; ; ) References: <4A9D8057.8020307@intersonic.se> <4A9D89CB.6060206@intersonic.se> <4A9D8FDB.9040908@prgmr.com> In-Reply-To: <4A9D8FDB.9040908@prgmr.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200909021624.38655.mel.flynn+fbsd.questions@mailing.thruhere.net> Cc: 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 14:24:42 -0000 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. -- Mel