git: kernel - Reduce vm_page_list_find2() stalls

Matthew Dillon dillon at
Tue Feb 26 08:49:56 PST 2019

commit 53ddc8a198b5a5c24b31cda0826a166e533d4a82
Author: Matthew Dillon <dillon at>
Date:   Mon Feb 25 22:58:24 2019 -0800

    kernel - Reduce vm_page_list_find2() stalls
    * Reduce stalls in vm_page_list_find2() which can occur in low-memory
      situations, as well as in other situations.  The problem is two fold.
      First, that potentially all cpu cores can wind up waiting for a
      single vm_page's spin-lock to be released.
      Second, that a long-held vm_page spin-lock can cause the VM system
      to stall unnecessarily long.
    * Change vm_page_list_find() and vm_page_list_find2() to no longer
      unconditionally spinlock a vm_page candidate and then retry if it
      is found to be on the wrong queue.
      Instead the code now spinlocks the queue, then iterates vm_page
      candidates using spin_trylock(), skipping any pages whos spinlocks
      cannot be immediately acquired.  This is lock-order-reversed but
      is ok because we use trylock.  Also, by locking the queue first we
      guarantee that a successfully spinlocked vm_page will be on the
      correct queue.
    * Should also reduce IPIQ drain stalls reported to the console as
      shown below.  The %rip sample is often found in vm_page_list_find2().
      send_ipiq X->Y tgt not draining (STALL_SECONDS)

Summary of changes:
 sys/vm/vm_page.c | 60 ++++++++++++++++++++++++++++++++++++--------------------
 1 file changed, 39 insertions(+), 21 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list