git: kernel - VM rework part 4 - Implement vm_fault_collapse()

Matthew Dillon dillon at
Fri May 10 09:26:43 PDT 2019

commit 1c024bc6b7701ee3fe63b25733333feb0a0e472b
Author: Matthew Dillon <dillon at>
Date:   Thu May 9 18:37:10 2019 -0700

    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

Summary of changes:
 sys/vm/vm_extern.h |   1 +
 sys/vm/vm_fault.c  | 214 ++++++++++++++++++++++++-----------------------------
 sys/vm/vm_map.c    | 101 ++++++++++++++++++++++++-
 sys/vm/vm_object.h |   1 +
 4 files changed, 200 insertions(+), 117 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list