git: kernel - Wakeup threads blocked in the VM page allocator more quickly

Matthew Dillon dillon at
Thu Jun 27 00:04:11 PDT 2013

commit 77d1fb91cace7f1779195614024e920f1b70b275
Author: Matthew Dillon <dillon at>
Date:   Wed Jun 26 23:40:29 2013 -0700

    kernel - Wakeup threads blocked in the VM page allocator more quickly
    Additional tuning to changes in the way the pageout daemon and VM system
    wakes up threads blocked allocating normal VM pages.  Previously the VM
    system would wait for the vm_paging_target() to be reached before waking
    up all waiters, and had code to try to wakeup individual threads past
    the minimum.
    This just didn't work very well on machines with lots of memory because
    it could take quite a long time for the pageout daemon to actually reach
    the vm_paging_target() (and VM load could prevent it from being reached at
    all!).  Many threads could wind up being blocked indefinitely waiting for
    cache and/or free page counts to reach reasonable levels.
    The solution is to give the kernel time to build up a smaller number
    of free+cache pages beyond the minimum, enough to give all waiting threads
    a fair shot at allocating at least one page, and then simply wakeup all
    the waiters.  This hysteresis is set smallish on purpose, defaulting to
    a value of 16 in order to avoid holding threads blocked for excessive
    periods of time.
    Under heavy VM loads this creates an overlap between memory consumers and
    the pageout daemon, allowing the pageout daemon to run continuously in
    these situations.
    * Add the vm.page_free_hysteresis sysctl, initialized to 16.  This field
      specifies a small number of pages past the minimum required for normal
      system operation before the VM system will wakeup threads blocked in the
      VM page allocator.
    * Adjust tmpfs to force-free pages through the hysteresis value to reduce
      degenerate block/wakeup situations under heavy VM loads.

Summary of changes:
 sys/vfs/tmpfs/tmpfs_vnops.c |  2 +-
 sys/vm/vm_page.c            | 32 +++++++++++++++++++++++++++-----
 sys/vm/vm_page2.h           |  4 ++++
 sys/vm/vm_pageout.c         | 21 ++++++++++++++++-----
 sys/vm/vm_pageout.h         |  1 +
 5 files changed, 49 insertions(+), 11 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list