git: kernel - Fix bug in machdep.pmap_mmu_optimize

Matthew Dillon dillon at crater.dragonflybsd.org
Tue Oct 31 10:49:58 PDT 2017


commit c5030460c671e6a0248bf652a3f6b52590d90916
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Fri Oct 20 23:43:15 2017 -0700

    kernel - Fix bug in machdep.pmap_mmu_optimize
    
    * Fix a bug in the pmap_mmu_optimize feature (default disabled).  When
      enable this feature will automatically share page table pages with
      equivalent permissions for objects covering the whole page table page.
    
    * However, the code which cleaned out the 'old' page table page failed
      to properly lock its pindex across the replacement operation, likely
      allowing threaded programs to sometimes race it and potentially
      lose track of one or more PTEs.
    
      The code tried to hold onto proc_pd_pv to prevent races, but there is
      still a small window due to the fact that pmap_allocpte() allocates
      pv's from the leaf upward.  So if the pmap optimization is good in
      one thread but the fails in another for the same page table (for
      example, due to a vm_map_entry split), a race can ensue.
    
    * Use the existing pt_placemarker feature to properly lock the empty
      page table page slot while it is being replaced.
    
    * Add a soft-locking mechanism to temporarily work around a
      (usually short-lived) allocation live-lock which can crop up
      when one thread is trying to replace a page table page while
      another is trying to allocate to it.

Summary of changes:
 sys/platform/pc64/include/pmap.h |  1 +
 sys/platform/pc64/x86_64/pmap.c  | 86 +++++++++++++++++++++++++++++++++-------
 2 files changed, 73 insertions(+), 14 deletions(-)

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


-- 
DragonFly BSD source repository


More information about the Commits mailing list