readahead: make context readahead more conservative

This helps performance on moderately dense random reads on SSD.

Transaction-Per-Second numbers provided by Taobao:

		QPS	case
		-------------------------------------------------------
		7536	disable context readahead totally
w/ patch:	7129	slower size rampup and start RA on the 3rd read
		6717	slower size rampup
w/o patch:	5581	unmodified context readahead

Before, readahead will be started whenever reading page N+1 when it happen
to read N recently.  After patch, we'll only start readahead when *three*
random reads happen to access pages N, N+1, N+2.  The probability of this
happening is extremely low for pure random reads, unless they are very
dense, which actually deserves some readahead.

Also start with a smaller readahead window.  The impact to interleaved
sequential reads should be small, because for a long run stream, the the
small readahead window rampup phase is negletable.

The context readahead actually benefits clustered random reads on HDD
whose seek cost is pretty high.  However as SSD is increasingly used for
random read workloads it's better for the context readahead to concentrate
on interleaved sequential reads.

Another SSD rand read test from Miao

        # file size:        2GB
        # read IO amount: 625MB
        sysbench --test=fileio          \
                --max-requests=10000    \
                --num-threads=1         \
                --file-num=1            \
                --file-block-size=64K   \
                --file-test-mode=rndrd  \
                --file-fsync-freq=0     \
                --file-fsync-end=off    run

shows the performance of btrfs grows up from 69MB/s to 121MB/s, ext4 from
104MB/s to 121MB/s.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Tested-by: Tao Ma <tm@tao.ma>
Tested-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
deadline: Allow 0ms deadline latency, increase the read speed

Change a timer compare from after to after-equals, thus allowing
0 timeout and making deadline schedule FIFO.

Signed-off-by: xiaobing tu <xiaobing.tu@intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: flar2 <asegaert@gmail.com>
Add /dev/frandom support
block: Reserve only one queue tag for sync IO if only 3 tags are available

In case a device has three tags available we still reserve two of them
for sync IO. That leaves only a single tag for async IO such as
writeback from flusher thread which results in poor performance.

Allow async IO to consume two tags in case queue has three tag availabe
to get a decent async write performance.

This patch improves streaming write performance on a machine with such disk
from ~21 MB/s to ~52 MB/s. Also postmark throughput in presence of
streaming writer improves from 8 to 12 transactions per second so sync
IO doesn't seem to be harmed in presence of heavy async writer.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: flar2 <asegaert@gmail.com>
cpufreq: Add Many Governors

* Look below to see everything I added :)

Signed-off-by: Chester Kener <Cl3Kener@gmail.com>

cpufreq: InteractiveX CPU governor

Modified version of interactive with sleep+wake code

Signed-off-by: Chester Kener <Cl3Kener@gmail.com>

cpufreq: OnDemandX CPU governor

Signed-off-by: Chester Kener <Cl3Kener@gmail.com>

cpufreq: Lionheart CPU governor

A brave and agile conservative-based governor

Signed-off-by: Chester Kener <Cl3Kener@gmail.com>

cpufreq: SmartAssV2 CPU governor

A smart optimized governor based on OnDemand

Signed-off-by: Chester Kener <Cl3Kener@gmail.com>

cpufreq: LulzActive CPU governor

A new interactive governor developed by Tegrak.
For more information please visit:
http://tegrak2x.blogspot.com/2011/11/lulzactive-governor-v2.html

Signed-off-by: Chester Kener <Cl3Kener@gmail.com>

cpufreq: Adaptive CPU governor

This driver adds a dynamic cpufreq policy governor designed for
latency-sensitive workloads and also for demanding performance.
This governor attempts to reduce the latency of clock increases so
that the system is more responsive to interactive workloads in loweset
steady-state but to reduce power consumption in middle operation level
up will be done in step by step to prohibit system from going to max
operation level.

Signed-off-by: Chester Kener <Cl3Kener@gmail.com>

cpufreq: Hyper CPU governor

A tweaked OnDemand based smart and smooth optimized governor

Signed-off-by: Chester Kener <Cl3Kener@gmail.com>

cpufreq: BrazilianWax CPU governor

A slightly more agressive smart optimized governor

Signed-off-by: Chester Kener <Cl3Kener@gmail.com>

cpufreq: Intellidemand CPU governor

This is an 'ondemand' based CPU governor created by Faux123 (thanks to him for his awesome work)

Signed-off-by: Chester Kener <Cl3Kener@gmail.com>

Fix

Signed-off-by: Chester Kener <Cl3Kener@gmail.com>

Conflicts:
	drivers/cpufreq/cpufreq_intellidemand.c