You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Doug MacEachern <do...@covalent.net> on 2001/08/02 00:30:06 UTC

Re: swapping of mod_perl parent process / mlockall()

On Mon, 16 Jul 2001, Adi Fairbank wrote:
 
> Actually, I don't want child processes to inherit the page locks across a
> fork.  I just wanted to experiment with performance issues when only the
> parent process is locked in memory.  (I have a theory that when the parent
> process swaps to disk, the swapped pages become unshared for the rest of the
> server's life)
> 
> I was hoping you could give me a hint as to where in the source code I could
> call mlockall(), e.g. file mod_perl.c, line NNN..

you should just be able to create a module with a .xs something like:
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "sys/mman.h"

MODULE = Mlock		PACKAGE = Mlock		

int
mlockall()

  CODE:
  RETVAL = (mlockall(MCL_CURRENT) == 0);

  OUTPUT:
  RETVAL

and call Mlock::mlockall(); in a startup script.