kernel - VM rework part 4 - Implement vm_fault_collapse()
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 10 May 2019 01:37:10 +0000 (18:37 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 10 May 2019 16:24:58 +0000 (09:24 -0700)
commit1c024bc6b7701ee3fe63b25733333feb0a0e472b
tree1e9e7fb3191ff6f8c8e6d63830d208c12f9709b9
parent44293a8055ecb27ff83ef3482f7e2fd33b35ebe8
kernel - VM rework part 4 - Implement vm_fault_collapse()

* Add the function vm_fault_collapse().  This function simulates
  faults to copy all pages from backing objects into the front
  object, allowing the backing objects to be disconnected
  from the map entry.

  This function is called under certain conditions from the
  vmspace_fork*() code prior to a fork to potentially collapse
  the entry's backing objects into the front object.  The
  caller then disconnects the backing objects, truncating the
  list to a single object (the front object).

  This optimization is necessary to prevent the backing_ba list
  from growing in an unbounded fashion.  In addition, being able
  to disconnect the graph allows redundant backing store to
  be freed more quickly, reducing memory use.

* Add sysctl vm.map_backing_shadow_test (default enabled).
  The vmspace_fork*() code now does a quick all-shadowed test on
  the first backing object and calls vm_fault_collapse()
  if it comes back true, regardless of the chain length.

* Add sysctl vm.map_backing_limit (default 5).
  The vmspace_fork*() code calls vm_fault_collapse() when the
  ba.backing_ba list exceeds the specified number of entries.

* Performance is a tad faster than the original collapse
  code.
sys/vm/vm_extern.h
sys/vm/vm_fault.c
sys/vm/vm_map.c
sys/vm/vm_object.h