kernel - Refactor cpu localization for VM page allocations
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 30 Jul 2016 00:03:22 +0000 (17:03 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sat, 30 Jul 2016 00:13:33 +0000 (17:13 -0700)
commit33ee48c40cdb9dc1074a60d2a003c9ea1db0533e
treec94f1287c3b38c0ed625bdf2d94160d4105c2fc5
parent96ce82a2fb9845ca42572a7c42fea0cef136db56
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.
sys/kern/subr_cpu_topology.c
sys/sys/cpu_topology.h
sys/sys/globaldata.h
sys/vm/vm_object.c
sys/vm/vm_page.c