Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 1C8129F9C4F for ; Fri, 21 Sep 2007 05:29:53 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 52525-01 for ; Fri, 21 Sep 2007 05:29:31 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mail.ecircle.de (mail.ecircle.de [195.140.186.200]) by postgresql.org (Postfix) with ESMTP id 0E9C49F9B59 for ; Fri, 21 Sep 2007 05:29:36 -0300 (ADT) Received: from einstein.muc.ecircle.de (einstein.muc.ecircle.de [192.168.1.7]) by mail.ecircle.de (READY) with ESMTP id 8A65911C026; Fri, 21 Sep 2007 10:29:25 +0200 (CEST) Received: from [192.168.1.91] ([192.168.1.91]) by einstein.muc.ecircle.de with Microsoft SMTPSVC(6.0.3790.1830); Fri, 21 Sep 2007 10:29:25 +0200 Subject: Re: Linux mis-reporting memory From: Csaba Nagy To: Gregory Stark Cc: Decibel! , pgsql-performance@postgresql.org In-Reply-To: <87r6ksa1jb.fsf@oxford.xeocode.com> References: <20070920230400.GM95343@decibel.org> <16213.1190329934@sss.pgh.pa.us> <87r6ksa1jb.fsf@oxford.xeocode.com> Content-Type: text/plain Date: Fri, 21 Sep 2007 10:30:01 +0200 Message-Id: <1190363401.4661.116.camel@PCD12478> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 21 Sep 2007 08:29:25.0284 (UTC) FILETIME=[84A87640:01C7FC29] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/349 X-Sequence-Number: 26894 On Fri, 2007-09-21 at 09:03 +0100, Gregory Stark wrote: > >> Mem: 32945280k total, 32871832k used, 73448k free, 247432k buffers > >> Swap: 1951888k total, 42308k used, 1909580k free, 30294300k cached > > > It seems to imply Linux is paging out sysV shared memory. In fact some of > Heikki's tests here showed that Linux would do precisely that. But then why is it not reporting that in the "Swap: used" section ? It only reports 42308k used swap. I have a box where I just executed 3x a select count(*) from a table which has ~5.5 GB size on disk, and the count executed in <4 seconds, which I take as it is all cached (shared memory is set to 12GB - I use the box for testing for now, otherwise I would set it far lower because I have bad experience with setting it more than 1/3 of the available memory). Top reported at the end of the process: Mem: 16510724k total, 16425252k used, 85472k free, 10144k buffers Swap: 7815580k total, 157804k used, 7657776k free, 15980664k cached I also watched it during the selects, but it was not significantly different. So my only conclusion is that the reported "cached" value is either including the shared memory or is simply wrong... or I just don't get how linux handles memory. Cheers, Csaba.