git: kernel - more SMP optimizations in the VM system

Matthew Dillon dillon at
Thu Oct 24 00:18:42 PDT 2013

commit 2734d278f143c02c9332df562f5b768835de13a4
Author: Matthew Dillon <dillon at>
Date:   Wed Oct 23 23:53:16 2013 -0700

    kernel - more SMP optimizations in the VM system
    * imgact_elf - drop the vm_object a little earlier in load_section(),
      and use a shared object lock when iterating ELF segments.
    * When starting a vforked process use a shared process token to
      interlock the wait loop instead of an exclusive token.  Also don't
      bother with the token if there's nothing to wait for.
    * When forking, pre-assign lp2 thread's td_ucred.
    * Remove the vp->v_object load check loop.  It should not be possible
      for vp->v_object to change after being assigned as long as the vp
      is referenced.
    * Replace most OBJ_DEAD tests with assertions that the flag is not set.
    * Remove the VOLOCK/VOWANT vnode interlock.  It shouldn't be possible
      for the vnode's object to change while the vnode is ref'd.  This was
      a leftover from a long-ago time when vnodes were more persistent and
      could be recycled and race accessors.
      This also removes vm_object_dead_sleep/wait and related code.
    * When memory mapping a vnode object there is no need to formally
      hold and chain_wait the object.  We can simply add a ref to it,
      because vnode objects cannot have backing chains.
    * When deallocating a vm_object we can shortcut counts greater than 1
      for OBJT_VNODE objects instead of counts greater than 3.
    * Optimize vnode_pager_alloc(), avoiding unnecessary locks.  Keep the
      temporary vnode token for the moment.
    * Optimize vnode_pager_reference(), removing all locks from the path.

Summary of changes:
 sys/kern/imgact_elf.c | 21 ++++++------
 sys/kern/kern_fork.c  | 11 +++---
 sys/kern/vfs_subr.c   | 21 ++++--------
 sys/sys/vnode.h       |  4 +--
 sys/vm/vm_map.c       | 26 ++++++++++----
 sys/vm/vm_object.c    | 39 ++-------------------
 sys/vm/vm_object.h    |  2 --
 sys/vm/vnode_pager.c  | 94 +++++++++------------------------------------------
 8 files changed, 64 insertions(+), 154 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list