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.