git: kernel - Major refactor of pageout daemon algorithms (2)

Matthew Dillon dillon at
Mon May 17 23:11:08 PDT 2021

commit 2198d48d13b680ca7a6ab9e1b5ca226967bcc1e5
Author: Matthew Dillon <dillon at>
Date:   Mon May 17 21:57:37 2021 -0700

    kernel - Major refactor of pageout daemon algorithms (2)
    * Refactor the pageout daemon's 'pass' variable handling.  No longer
      sleep or slow down the pageout daemon if paging has been running for
      a long time, doing so just places the system in an unrecoverable
    * Fix a vm_paging_target2() test that was inverted.  This caused the
      vm_pageout_scan_inactive() to improperly break out after scanning
      one page per queue (x 1024 queues so it wasn't readily apparent).
    * Modify the 'vmwait' and 'pfault' trip points (that block a process on
      low memory) based on the process nice value.  The result is that nice +N
      processes which are heavy memory users will tend to block before
      completely exhausting the FREE+CACHE pool, allowing other lower-niced
      processes to continue running somewhat normally.
      I say somewhat because the mechanism isn't perfect.  However, it should
      be good enough that if bulk work is partitioned a bit with higher nice
      values, shells should remain responsive enough to diagnose issues even
      during extreme paging.
    * For the moment make the 'vmwait' trip point only slightly worse
      than the 'pfault' trip point at any given p_nice.  The 'vmwait' trip
      point used to be significantly worse (that is, would trip earlier).
      We have generally found that blockages on pfault are significantly more
      damaging to performance than blockages on I/O-related allocations, so
      don't completely equalize the two trip points.
    * Have the pageout code check for and report possible vm_page queue
      races when removing pages.  In particular, pages appear to be able
      to wind up in PQ_CACHE that are still PG_MAPPED.
    * Fix various calculations that divide by MAXSCAN_DIVIDER to error
      on the high-side instead of the low-side.
    * Fix vm.pageout_debug output to reduce spew.

Summary of changes:
 sys/vm/vm_page.c    |  39 ++++++++++++++---
 sys/vm/vm_page2.h   |  27 ++++++++++++
 sys/vm/vm_pageout.c | 120 +++++++++++++++++++++++++++++++---------------------
 3 files changed, 130 insertions(+), 56 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list