vm.pmap.shpgperproc and Apache

Mark Tinguely tinguely at casselton.net
Mon Nov 26 16:37:34 PST 2007

>  (This is about 7.0-BETA3 amd64)
>  Can someone explain to someone who isn't a VM guru exactly what 
>  vm.pmap.shpgperproc does?

In non-technical terms, shpgperproc tells the OS a rough guess of how many
pages will be shared between processes. The pv_entry_max is generated by
multiplying shpgperproc by the maximum number of processes (maxproc) that
was compiled into the kernel and adjusts for the page count. If maxproc was
not hardcoded, then maxproc is also calculated based on the number of pages
available in the computer

When processes shares a physical page, each process may have a different
virtual address for the page. The OS maintains a list of all the processes
that are sharing the managed physical page and virtual address in that process.
This structure also keeps a list of all the managed pages that are currently
being used by this process. The structure that make up these lists is called
a pv_entry.

The new "chunked" pv_entry in FreeBSD 7 and 8 for the amd64/i386 architectures
is very space efficient and IMO could tolerate higher shpgperproc/pv_entry_max

Raising the pv_entry_max too high, the problem will be getting a page for
the pv_entry chunk, as well as getting physical page to share. More memory
and increasing the pv_entry limits will help you avoid this problem.

--Mark Tinguely

More information about the freebsd-current mailing list