The Brain Fuck Scheduler v0.318 by Con Kolivas.

A single shared runqueue O(n) strict fairness earliest deadline first design.

Ultra low latency and excellent desktop performance for 1 to many CPUs.
Not recommended for 4096 cpus.

Scalability is optimal when your workload is equal to the number of CPUs on
bfs. ie you should ONLY do make -j4 on quad core, -j2 on dual core and so on.

Features SCHED_IDLEPRIO and SCHED_ISO scheduling policies as well.
You do NOT need to use these policies for good performance, they are purely
optional for even better performance in extreme conditions.

To run something idleprio, use schedtool like so:

schedtool -D -e make -j4

To run something isoprio, use schedtool like so:

schedtool -I -e amarok

Includes accurate sub-tick accounting of tasks so userspace reported
cpu usage may be very different if you have very short lived tasks.
Add above_background_load function to allow stuff to happen only when
important stuff aint.
Swappiness the tunable lies. It doesn't respect swappiness because it alters
the value when we're more than lightly loaded in the vm. Change it to -really-
mean swappiness unless we're about to go out of memory.
Yet to see a desktop workload that benefits from swappiness being higher than
zero. Make it so by default.
The swap token is only useful in conditions of swap thrash, and actually
worsens the common case by causing more swapping. Make it only have an effect
when swap is more than half full.
While it may be nice to have a copy of pages on swap once written there, the
more garbage we leave in the swapspace the slower any further writes and
reads to and from it are. Just free swapcache whenever we can.
When kswapd is awoken due to reclaim by a running task, set the priority of
kswapd to that of the calling task thus making memory reclaim cpu activity
affected by nice level.
Add a background scanning timer to restore the watermarks to the pages_lots
level and only call on it if kswapd has not been called upon for the last 5
seconds. This allows us to balance all zones to the more generous pages_lots
watermark at a time unrelated to page allocation thus leading to lighter
levels of vm load when called upon under page allocation.

Signed-off-by: Con Kolivas <kernel@kolivas.org>

The -ck patches modify mm/vmscan.c and add a timer to wake up kswapd every 5
seconds. This timer is initialized after the creation of the kswapd thread.

The kswapd() thread function calls mod_timer at the front of its infinite
service loop (to reset the timer to 5 seconds in the future). mod_timer()
includes a BUG_ON() to assert that the timer's callback function is set.

Since the wakeup timer is initialized after the kswapd thread is created, if
kswapd gets scheduled before kswapd_run() has prepared the timer, the
BUG_ON() check will throw a stack trace and immediately terminate the kswapd
thread.

This patch modifies the kswapd_run() function in mm/vmscan.c to initialize the
watermark timer before starting the kswapd thread.

Signed-off-by: Chase Venters <chase.venters at clientec.com>
Set the effective priority of idleprio tasks to that of nice 19 tasks when
modifying vm reclaim behaviour.
When reading from large files through the generic file read functions into
page cache we can detect when a file is so large that it is unlikely to be
fully cached in ram. If that happens we can put it on the tail end of the
inactive lru list so it can be the first thing evicted next time we need ram.

Do lots of funny buggers with underscores to preserve all the existing APIs.
Because of the way BFS works it needs to transition up in frequency more
aggressively and down more conservatively.