git: DragonFly_RELEASE_4_6 kernel - Refactor cpu localization for VM page allocations

Matthew Dillon dillon at
Fri Jul 29 17:18:51 PDT 2016

commit 10b3a023c445d08a3e98b2b503cd044be42490ac
Author: Matthew Dillon <dillon at>
Date:   Fri Jul 29 17:03:22 2016 -0700

    kernel - Refactor cpu localization for VM page allocations
    * Change how cpu localization works.  The old scheme was extremely unbalanced
      in terms of vm_page_queue[] load.
      The new scheme uses cpu topology information to break the vm_page_queue[]
      down into major blocks based on the physical package id, minor blocks
      based on the core id in each physical package, and then by 1's based on
      (pindex + object->pg_color).
      If PQ_L2_SIZE is not big enough such that 16-way operation is attainable
      by physical and core id, we break the queue down only by physical id.
      Note that the core id is a real core count, not a cpu thread count, so
      an 8-core/16-thread x 2 socket xeon system will just fit in the 16-way
      requirement (there are 256 PQ_FREE queues).
    * When a particular queue does not have a free page, iterate nearby queues
      start at +/- 1 (before we started at +/- PQ_L2_SIZE/2), in an attempt to
      retain as much locality as possible.  This won't be perfect but it should
      be good enough.
    * Also fix an issue with the idlezero counters.

Summary of changes:
 sys/kern/subr_cpu_topology.c | 26 ++++++++++++++++++
 sys/sys/cpu_topology.h       |  4 +++
 sys/sys/globaldata.h         |  3 ++-
 sys/vm/vm_object.c           | 16 +++++++++--
 sys/vm/vm_page.c             | 63 +++++++++++++++++++++++++++++++++++++-------
 5 files changed, 100 insertions(+), 12 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list