kernel - Refactor scheduler weightings part 2/2.
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 27 May 2019 00:20:48 +0000 (17:20 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Tue, 28 May 2019 04:48:26 +0000 (21:48 -0700)
commit4871f0f439ab7e3daa36852ff48cb9f488734716
tree0710a23809f3518798fe0c010b2877cac43d733c
parent09c8201c1dc313b919c1f3a3c3b69cb469fd41a6
kernel - Refactor scheduler weightings part 2/2.

* Change the default fork()ing mechanic from 0x80 (random cpu) to
  0x20 (best cpu).  We no longer need to mix it up on fork because
  weight4 now works.

* The best cpu algorithm has a number of desirable characteristics
  for fork() and fork()/exec().

  - Will generally start the child topologically 'close' to the parent,
    reducing fork/exec/exit/wait overheads, but still spread the children
    out while machine load is light.  If the child sticks around for
    long enough, it will get spread out even more optimally.  If not,
    closer is better.

  - Will not stack children up on the same cpu unnecessarily (e.g. parent
    fork()s a bunch of times at once).

  - Will optimize heavy and very-heavy load situations.  If the child
    have nowhere else reasonable to go, this will schedule it on a
    hyper-thread sibling or even on the same cpu as the parent.  Depending
    on the load.

* Gives us around a 15% improvement in fork/exec/exit/wait performance.

* Once a second we clear the td_wakefromcpu hint on the currently
  running thread.  This allows a thread which has become cpu-bound
  to start to 'wander' afield (though the scheduler will still try to
  avoid moving it too far away, topologically).
sys/kern/kern_clock.c
sys/kern/kern_fork.c
sys/kern/usched_dfly.c