git: kernel - Reduce SMP contention during low-memory stress

Matthew Dillon dillon at
Fri Feb 14 21:47:20 PST 2020

commit 13c79986ddcecf38606a5b503c5f63479defc558
Author: Matthew Dillon <dillon at>
Date:   Fri Feb 14 21:39:32 2020 -0800

    kernel - Reduce SMP contention during low-memory stress
    * When memory gets low vm_page_alloc() is forced to stray into
      adjacent VM page queues to find free pages.  This search can
      expand to the whole queue and cause massive SMP contention on
      systems with many cores.
      For example, if PQ_FREE has almost no pages but PQ_CACHE has
      plenty of pages, the previous scan code widened its search
      to the entire PQ_FREE queue (causing a ton of SMP contention)
      before beginning a search of PQ_CACHE.
    * The new scan code starts in PQ_FREE but once the search widens
      sufficiently it will also simultaneously begin searching PQ_CACHE.
      This allows the system to continue to allocate memory with minimal
      contention as long as PQ_FREE or PQ_CACHE have pages.
    * The new mechanism integrated a whole lot better with pageout
      daemon behavior.  The pageout daemon generally triggers off
      the FREE+CACHE total and not (generally) off of low levels
      for one or the other.

Summary of changes:
 sys/vm/vm_page.c    | 288 ++++++++++++++++++++++++++++++++++++++++++++++++----
 sys/vm/vm_pageout.c |   4 +-
 2 files changed, 271 insertions(+), 21 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list