git: kernel - Refactor the vmspace locking code and several use cases

Matthew Dillon dillon at
Thu Dec 1 17:12:43 PST 2011

commit a2ee730d0cec9395df7e733b2ca627cccbb0633a
Author: Matthew Dillon <dillon at>
Date:   Thu Dec 1 16:54:19 2011 -0800

    kernel - Refactor the vmspace locking code and several use cases
    * Reorder the vnode ref/rele sequence in the exec path so p_textvp is
      left in a more valid state while being initialized.
    * Removing the vm_exitingcnt test in exec_new_vmspace().  Release
      various resources unconditionally on the last exiting thread regardless
      of the state of exitingcnt.  This just moves some of the resource
      releases out of the wait*() system call path and back into the exit*()
    * Implement a hold/drop mechanic for vmspaces and use them in procfs_rwmem(),
      vmspace_anonymous_count(), and vmspace_swap_count(), and various other
      This does a better job protecting the vmspace from deletion while various
      unrelated third parties might be trying to access it.
    * Implement vmspace_free() for other code to call instead of them trying
      to call sysref_put() directly.  Interlock with a vmspace_hold() so
      final termination processing always keys off the vm_holdcount.
    * Implement vm_object_allocate_hold() and use it in a few places in order
      to allow OBJT_SWAP objects to be allocated atomically, so other third
      parties (like the swapcache cleaning code) can't wiggle their way in
      and access a partially initialized object.
    * Reorder the vmspace_terminate() code and introduce some flags to ensure
      that resources are terminated at the proper time and in the proper order.

Summary of changes:
 sys/kern/imgact_resident.c  |    2 +-
 sys/kern/kern_exec.c        |   19 ++---
 sys/vfs/procfs/procfs_mem.c |    2 +
 sys/vm/device_pager.c       |    5 +-
 sys/vm/swap_pager.c         |    5 +-
 sys/vm/vm_extern.h          |    4 +
 sys/vm/vm_glue.c            |    2 +-
 sys/vm/vm_map.c             |  176 ++++++++++++++++++++++++++++---------------
 sys/vm/vm_map.h             |    8 ++-
 sys/vm/vm_object.c          |   21 +++++-
 sys/vm/vm_object.h          |    1 +
 sys/vm/vm_vmspace.c         |    6 +-
 sys/vm/vm_zone.c            |    1 +
 13 files changed, 170 insertions(+), 82 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list