Currently we allocate and map zero-filled anonymous pages when dumping
core. This can result in lots of needless disk I/O and page
allocations. Try to make the core dumper more clever and represent
unbacked ranges of virtual memory by holes in the core dump.
To implement this, we need a way to test whether the pager for a given
virtual page contains the page's contents. This is done using a new
fault flag which causes vm_fault() to give up when it would otherwise
zero-fill an anonymous page.
Then, core_ouput() locates maximal runs of virtual memory that are
either contained or not contained in the backing pager. The former are
written as usual, using vn_rdwr_inchunks(), and the latter are written
by extending the core dump file using VOP_SETATTR. This assumes that
all writes to the core dump file are appending writes, but this is
already assumed by the compressed core dump code.