git: kernel - Numerous VM MPSAFE fixes

Matthew Dillon dillon at crater.dragonflybsd.org
Thu Sep 29 14:56:04 PDT 2011


commit a5fc46c91597d0af0cfa8fd257b4a8ed6e1cf341
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Thu Sep 29 14:46:42 2011 -0700

    kernel - Numerous VM MPSAFE fixes
    
    * Remove most critical sections from the VM subsystem, these are no longer
      applicable (vm_token covers the access).
    
    * _pmap_allocpte() for x86-64 - Conditionalize the zeroing of the vm_page
      after the grab.  The grab can race other threads and result in a page
      which had already been zero'd AND populated with pte's, so we can't just
      zero it.
    
      Use m->valid to determine if the page is actually newly allocated or not.
    
      NOTE: The 32 bit code already properly zeros the page by detecting whether
    	the pte has already been entered or not.  The 64-bit code couldn't
    	do this neatly so we used another method.
    
    * Hold the pmap vm_object in pmap_release() and pmap_object_init_pt() for
      the x86-64 pmap code.  This prevents related loops from blocking on the
      pmap vm_object when freeing VM pages which is not expected by the code.
    
    * pmap_copy() for x86-64 needs the vm_token, critical sections are no longer
      sufficient.
    
    * Assert that PG_MANAGED is set when clearing pte's out of a pmap via the
      PV entries.  The pte's must exist in this case and it's a critical panic
      if they don't.
    
    * pmap_replacevm() for x86-64 - Adjust newvm->vm_sysref prior to assigning
      it to p->p_vmspace to handle any potential MP races with other sysrefs
      on the vmspace.
    
    * faultin() needs p->p_token, not proc_token.
    
    * swapout_procs_callback() needs p->p_token.
    
    * Deallocate the VM object associated with a vm_page after freeing the
      page instead of before freeing the page.  This fixes a potential
      use-after-refs-transition-to-0 case if a MP race occurs.

Summary of changes:
 sys/platform/pc64/x86_64/pmap.c |  159 +++++++++++++++++++--------------------
 sys/vm/device_pager.c           |    2 -
 sys/vm/phys_pager.c             |    2 -
 sys/vm/swap_pager.c             |   38 ---------
 sys/vm/vm_contig.c              |   11 ---
 sys/vm/vm_glue.c                |   23 ++++--
 sys/vm/vm_map.c                 |    2 +
 sys/vm/vm_object.c              |   19 +-----
 sys/vm/vm_pageout.c             |   45 +++---------
 sys/vm/vm_swapcache.c           |    2 -
 10 files changed, 107 insertions(+), 196 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/a5fc46c91597d0af0cfa8fd257b4a8ed6e1cf341


-- 
DragonFly BSD source repository





More information about the Commits mailing list