From owner-freebsd-hackers Thu Jan 30 1:14:25 2003 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 769AF37B401 for ; Thu, 30 Jan 2003 01:14:24 -0800 (PST) Received: from HAL9000.homeunix.com (12-233-57-224.client.attbi.com [12.233.57.224]) by mx1.FreeBSD.org (Postfix) with ESMTP id 454D243F93 for ; Thu, 30 Jan 2003 01:14:23 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.6/8.12.5) with ESMTP id h0U9EKNt007995; Thu, 30 Jan 2003 01:14:20 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.6/8.12.5/Submit) id h0U9EJBR007994; Thu, 30 Jan 2003 01:14:19 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Date: Thu, 30 Jan 2003 01:14:19 -0800 From: David Schultz To: Matthew Dillon Cc: James Gritton , freebsd-hackers@FreeBSD.ORG Subject: Re: What's the memory footprint of a set of processes? Message-ID: <20030130091419.GA7776@HAL9000.homeunix.com> Mail-Followup-To: Matthew Dillon , James Gritton , freebsd-hackers@FreeBSD.ORG References: <20030130064448.GA7258@HAL9000.homeunix.com> <200301300719.h0U7JOfI086054@apollo.backplane.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200301300719.h0U7JOfI086054@apollo.backplane.com> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Thus spake Matthew Dillon : > Generally speaking I don't think you have to go into this level of > detail to figure out approximate real memory use. Just look at the > output of the /proc/PID/map and pull out the 'default' or 'swap' > lines. Ignore the 'vnode' lines. ... > Now you have two metrics. You can calculate the size based on the > range (the first two arguments). (addressB - addressA), and you can get > the total number of resident pages from the third argument. What you > can't do easily is figure out the total allocation because that is > actually going to be resident pages + swapped pages. swapped pages is > not included in the proc output. I think the original poster wanted to know the real memory use of a set of processes, taking sharing into account. I don't see how your approach could do that. Even if you knew the structure of the shadow chain, you would have to know specifically which pages had been COWed, no? I thought counting vm_page structures would be the way to go... I really want to find the time to learn all this stuff better. I still don't know the difference between COW and NEEDS_COPY, or why the pageout daemon seems to be biased against shared pages, or a lot of things about pv_entry structures. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message