kernel - Greatly improve concurrent fork's and concurrent exec's
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 12 Oct 2013 23:10:36 +0000 (16:10 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sat, 12 Oct 2013 23:40:21 +0000 (16:40 -0700)
commit501747bf193f9b67958bbda50cc3386af1dab1b2
tree0446f0a14b14dbdc18e2f9b862d10cb018aeaaad
parenta66fe2e3d21fcf34c44919a03c6d61bb3dea89c6
kernel - Greatly improve concurrent fork's and concurrent exec's

* Rewrite all the vm_fault*() API functions to use a two-stage methodology
  which keeps track of whether a shared or exclusive lock is being used
  on fs.first_object and fs.object.  For most VM faults a shared lock is
  sufficient, particularly under fork and exec circumstances.

  If the shared lock is not sufficient the functions will back-down to an
  exclusive lock on either or both elements.

* Implement shared chain locks for use by the above.

* kern_exec - exec_map_page() now attempts to access the page with a
  shared lock first, and backs down to an exclusive lock if the page
  is not conveniently available.

* vm_object ref-counting now uses atomic ops across the board.  The
  acquisition call can operate with a shared object lock.  The deallocate
  call will optimize decrementation of ref_count for values above 3 using
  an atomic op without needing any lock at all.

* vm_map_split() and vm_object_collapse() and associated functions are now
  smart about handling terminal (e.g. OBJT_VNODE) VM objects and will use
  a shared lock when possible.

* When creating new shadow chains in front of a OBJT_VNODE object, we no
  longer enter those objects onto the OBJT_VNODE object's shadow_head.
  That is, only DEFAULT and SWAP objects need to track who might be shadowing
  them.  TODO: This code needs to be cleaned up a bit though.

  This removes another exclusive object lock from the critical path.

* vm_page_grab() will use a shared object lock when possible.
sys/kern/imgact_elf.c
sys/kern/kern_exec.c
sys/kern/sysv_shm.c
sys/kern/vfs_subr.c
sys/vm/swap_pager.c
sys/vm/vm_fault.c
sys/vm/vm_map.c
sys/vm/vm_object.c
sys/vm/vm_object.h
sys/vm/vm_page.c
sys/vm/vnode_pager.c