Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Mar 2009 11:01:41 +0100
From:      cpghost <cpghost@cordula.ws>
To:        Wojciech Puchar <wojtek@wojtek.tensor.gdynia.pl>
Cc:        cpghost <cpghost@cordula.ws>, freebsd-questions@freebsd.org
Subject:   Re: Speeding up exit(2)?
Message-ID:  <20090315100141.GA1282@phenom.cordula.ws>
In-Reply-To: <alpine.BSF.2.00.0903151027050.41063@wojtek.tensor.gdynia.pl>
References:  <20090315091301.GB1051@phenom.cordula.ws> <alpine.BSF.2.00.0903151027050.41063@wojtek.tensor.gdynia.pl>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
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/



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?20090315100141.GA1282>