git: kernel - Refactor scheduler weightings part 1/2.

Matthew Dillon dillon at
Sun May 26 09:50:21 PDT 2019

commit ac7fb7bad4e09467ca586c380797263cfe7cb14b
Author: Matthew Dillon <dillon at>
Date:   Sun May 26 09:37:51 2019 -0700

    kernel - Refactor scheduler weightings part 1/2.
    * Refactor the scheduler's weightings and fix a few issues that
      have cropped up due to breaking previous tunings.  This gets
      our pgbench results back to normal.
    * There will probably be a follow-up commit with a bit more
      tuning work, particular with regards to resetting the
      td_wakefromcpu field which we currently do not do at all.
    * Increase weight1 (keep thread on current CPU) slightly,
      implement weight4, and re-tune the algorithm.
    * Break-out the IPC pairing control fields into two new
      sysctls, kern.usched_dfly.ipc_smt and kern.usched_dfly.ipc_same,
      with the default set to -1 (auto).
      ipc_smt	Tries to schedule IPC pairings onto sibling
    		hyperthreads to avoid cache mastership changes
    		when the load is greater than (ncpus / 2).
      ipc_same	Tries to schedule IPC pairings onto the same
    		logical cpu to avoid both cache mastership changes
    		AND IPIs when the load is greater than (ncpus).
    * Keep in mind that the scheduler cannot perfectly predict program
      behavior.  In particular, these IPC pairings can work better or worse
      depending on the mix between local cpu use within each process,
      verses the amount of data being transfered between them.  By default
      we try to localize IPC pairings to nearby cores but we do not try
      to schedule them to sibling hyperthreads unless the load is high
      enough for it to make sense.
    * The main IPC weighting is weight2, whereas the fairness metric is
      weight4.  Generally speaking, weight4 should be somewhat smaller
      than weight2 but still high enough to ensure that available CPUs
      in the system are reasonably well utilized.  Also note that the
      fairness metric (weight4) is based on priority-weighted load.

Summary of changes:
 sys/kern/kern_synch.c  |   9 +-
 sys/kern/usched_dfly.c | 262 +++++++++++++++++++++++++++++++++++++++----------
 2 files changed, 216 insertions(+), 55 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list