git: kernel - Fix swap issue, implement dynamic pmap PT/PD/PDP deletion

Matthew Dillon dillon at
Fri Dec 30 12:37:11 PST 2016

commit a7a03a5f23a9828719d348cb3c6c880d28003738
Author: Matthew Dillon <dillon at>
Date:   Fri Dec 30 12:21:26 2016 -0800

    kernel - Fix swap issue, implement dynamic pmap PT/PD/PDP deletion
    * The pmap code is now able to dynamically destroy PT, PD, and PDP
      page table pages when they become empty.  To do this we had to
      recode the higher-level page tables to wire on creation of a lower-level
      pv_entry instead of wiring on pte entry.
      DragonFly previously left PD and PDP pages intact, and possibly also PTs,
      until process exit.  In normal operation this had no real impact since
      most programs don't bloat up enough for the extra page table pages to
      matter, but its good to finally fix it as it allows the pmap footprint
      to be significantly reduced in the very few situations where a program
      bloats and unbloats during operation.
    * Fix an issue with recent swap changes.  We must increase the stripe
      between multiple swap devices to match the number of entries available
      on a radix leaf, which increased from 32 to 64.  This fixes a pstat -s
      accounting error that would sometimes attribute swap frees to the wrong
    * Refactor the RSS limiting code to scan the pmap instead of scan the
      vm_map and related underlying objects.  This greatly enhances performance
      because the underlying objects might have many pages that are not mapped.
      By scanning the pmap, we avoid having to sift through them all.
      Also makes use of the dynamic removal feature in the pmap code to restrict
      the effort required to do the pmap scan, and allows us to avoid most of
      the issues related to stacked VM objects.

Summary of changes:
 sys/platform/pc64/x86_64/pmap.c        | 475 +++++++++++++++++++++++++++------
 sys/platform/vkernel64/platform/pmap.c | 135 ++++++++++
 sys/sys/dmap.h                         |   3 -
 sys/vm/pmap.h                          |  20 ++
 sys/vm/swap_pager.c                    |  37 +--
 sys/vm/swap_pager.h                    |  13 +-
 sys/vm/vm_map.h                        |   2 +-
 sys/vm/vm_pageout.c                    | 369 +++++++------------------
 sys/vm/vm_swap.c                       |  29 +-
 9 files changed, 675 insertions(+), 408 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list