kernel - Add batch heuristic to scheduler and refactor some of the code 1/2
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 17 Feb 2011 08:47:58 +0000 (00:47 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 17 Feb 2011 08:47:58 +0000 (00:47 -0800)
commit52cac9fb50c0a148e396b28f986615dfd7a0ee95
tree4c56f1c2eb0cfd4a126626a5bb4530f19ec9a064
parent7bea4e6400e22ea6ced177c82b5f83aff4b8ea3f
kernel - Add batch heuristic to scheduler and refactor some of the code 1/2

* Split the dynamic priority mechanism into two stages:

* Stage 1 is the normal dynamic priority mechanism which reacts very quickly
  to cpu hogging vs idle / not hogging.

* Stage 2 is a long-term (30-second) batch operations detector which de-tunes
  the estcpu calculation based on how long the process has been acting
  batch-like or non-batch-like.  estcpu is detuned up to 50% for processes
  considered to be fully interactive.

* Newly forked processes are placed two queue slots higher (less desireable)
  than their parent in stage 1.  If they aren't batch they will quickly
  recover.

* Newly forked processes are given a batch heuristic value that is mid-range
  for stage 2 and must prove themselves one way or the other.

* 'ps -o batch -axl' can be used to see the batch heuristic.  ps will display
  it as a value between 0 and 11 for the moment.

  The idea here is for something like firefox and the X server to remain
  interactive even if they use a lot of cpu, while something like a parallel
  buildworld winds up remaining batch-like because the core processes are
  cpu-bound.
sys/kern/kern_exit.c
sys/kern/kern_kinfo.c
sys/kern/usched_bsd4.c
sys/kern/usched_dummy.c
sys/sys/usched.h