From owner-freebsd-questions@FreeBSD.ORG Sun Mar 15 10:01:45 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 2F8BE106564A for ; Sun, 15 Mar 2009 10:01:45 +0000 (UTC) (envelope-from cpghost@cordula.ws) Received: from fw.farid-hajji.net (fw.farid-hajji.net [213.146.115.42]) by mx1.freebsd.org (Postfix) with ESMTP id C13E98FC25 for ; Sun, 15 Mar 2009 10:01:44 +0000 (UTC) (envelope-from cpghost@cordula.ws) Received: from phenom.cordula.ws (phenom [192.168.254.60]) by fw.farid-hajji.net (Postfix) with ESMTP id ECC1D32F3D; Sun, 15 Mar 2009 11:01:42 +0100 (CET) Date: Sun, 15 Mar 2009 11:01:41 +0100 From: cpghost To: Wojciech Puchar Message-ID: <20090315100141.GA1282@phenom.cordula.ws> References: <20090315091301.GB1051@phenom.cordula.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.19 (2009-01-05) Cc: cpghost , freebsd-questions@freebsd.org Subject: Re: Speeding up exit(2)? 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: Sun, 15 Mar 2009 10:01:45 -0000 On Sun, Mar 15, 2009 at 10:27:53AM +0100, Wojciech Puchar wrote: > > Not sure what's really going on there, but apparently, the process > > reads in pages from swap that have been paged out previously > > (according to top(1)). > > is it your program and you are sure it's on exit? Every memory hungry program is concerned; and yes: it happens exactly on exit. > it's because the program is writted the way it's doing a lot of things > (probably unneeded) on exit. Have a look at what happens during exit: /usr/src/sys/kern/kern_exit.c:exit1() especially at the call to vm_waitproc(): /usr/src/sys/vm/vm_glue.c:vm_waitproc which calls vmspace_exitfree(): /usr/src/sys/vm/vm_map.c:vmspace_exitfree() Now, vmspace_exit() and vmspace_exitfree() ultimately call: /usr/src/sys/vm/vm_map.c:vmspace_dofree() It then goes deep into the bowels of vm amd pmap, and that's the place where the pages are paged in again (I think). > not exit(2) itself -cpghost. -- Cordula's Web. http://www.cordula.ws/