kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend v1.2 [Yank555.lu-faux123]

Squashed commits:

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend v1.2 [Yank555.lu]

- make kernel / userspace mode switchable

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend v1.1 [Yank555.lu]

- make powersuspend not depend on a userspace initiator anymore, but use a hook in autosleep instead.

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend [faux123]

- Android early_suspend/late_resume PM kernel driver framework has been deprecated by Google.
This new powersuspend PM kernel driver is a replacement for it and existing early_suspend drivers can be easily adapted to use this new replacement driver
mm: Dynamic management of dirty page writebacks [Christopher83]

This feature allows to have two different intervals for dirty page writebacks and to dynamically manage them when the system has been resumed (it's active) or when has been suspended.

Three new procfs parameters are exposed inside /proc/sys/vm path:

- dynamic_dirty_writeback is the activation status of this feature, set 1 to enable it, set 0 to disable it and use the standard behaviour
- dirty_writeback_active_centisecs is the interval for the dirty page writebacks when the system is active (screen on)
- dirty_writeback_suspend_centisecs is the interval for the dirty page writebacks when the system is suspended (screen off)

This feature is in part inspired on Francisco Franco's patch: franciscofranco/mako@34d7954

Signed-off-by: Cristoforo Cataldo <cristoforo.cataldo@gmail.com>

19.8.2014 disabled by default by UpInTheAir @XDA
config: enable DYNAMIC_PAGE_WRITEBACK

Conflicts:
	arch/arm/configs/SkyHigh_LTE_defconfig
	arch/arm/configs/SkyHigh_WIFI_defconfig
fs/aio.c: Asynchronous I/O latency to a solid-state disk greatly increased

between the 2.6.32 and 3.0 kernels. By removing the plug from do_io_submit(), we observed a 34% improvement in the I/O latency.

Unfortunately, at this level, we don't know if the request is to a rotating disk or not.

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: linux-aio@kvack.org
Cc: Chris Mason <chris.mason@oracle.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jeff Moyer <jmoyer@redhat.com>
config: enable AIO

Conflicts:
	arch/arm/configs/SkyHigh_T800_WIFI_defconfig
	arch/arm/configs/SkyHigh_T805_LTE_defconfig
kernel: sched: LOAD_FREQ (4*HZ+61) avoids loadavg Moire [AndreiLux]

LOAD_FREQ is (5*HZ+1) to avoid high load average when idle: http://kerneltrap.org/mailarchive/linux-kernel/2007/10/3/328568

I suggest (4*HZ+61) for a better distribution.

With some seconds based load (like SSL heartbeats) and LOAD_FREQ at (5*HZ+1) I see Moire patterns like inverse sawtooth, since 2 or 3 probes hit the jobs (load increases quickly), followed by several probes missing it.

A 4.61 sec interval gives optimal distribution over when within a second a probe is taken, as .61 is close to golden ratio phi 1.618... (test in http://ripke.com/goldenratio.c).

12*4.61 = 55.32 secs is still close to a minute, and 13*4.61=59.93 is even closer than the current 12*5.01=60.12 (with exponents EXP_x adjusted to a ratio of 13 instead of 12).
block: squashed commits to add FIOPS I/O scheduler [Shaohua Li]

block: fiops ioscheduler core

FIOPS (Fair IOPS) ioscheduler is IOPS based ioscheduler, so only targets for drive without I/O seek. It's quite similar like CFQ, but the dispatch decision is made according to IOPS instead of slice.

The algorithm is simple. Drive has a service tree, and each task lives in the tree. The key into the tree is called vios (virtual I/O). Every request has vios, which is calculated according to its ioprio, request size and so on. Task's vios is the sum of vios of all requests it dispatches. FIOPS always selects task with minimum vios in the service tree and let the task dispatch request. The dispatched request's vios is then added to the task's vios and the task is repositioned in the sevice tree.

Unlike CFQ, FIOPS doesn't have separate sync/async queues, because with I/O less writeback, usually a task can only dispatch either sync or async requests. Bias read or write request can still be done with read/write scale.

One issue is if workload iodepth is lower than drive queue_depth, IOPS share of a task might not be strictly according to its priority, request Bias read or write request can still be done with read/write scale.

One issue is if workload iodepth is lower than drive queue_depth, IOPS share of a task might not be strictly according to its priority, request size and so on. In this case, the drive is in idle actually. Solving the problem need make drive idle, so impact performance. I believe CFQ isn't completely fair between tasks in such case too.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>

Signed-off-by: Paul Reioux <reioux@gmail.com>

Conflicts:
        block/Kconfig.iosched
        block/Makefile

block: fiops read/write request scale

read/write speed of Flash based storage usually is different. For example, in my SSD maxium thoughput of read is about 3 times faster than that of write. Add a scale to differenate read and write. Also add a tunable, so user can assign different scale for read and write.

By default, the scale is 1:1, which means the scale is a noop.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>

block: fiops sync/async scale

CFQ gives 2.5 times more share to sync workload. This matches CFQ.

Note this is different with the read/write scale. We have 3 types of requests:
1. read
2. sync write
3. write
CFQ doesn't differentiate type 1 and 2, but request cost of 1 and 2 are usually different for flash based storage. So we have both sync/async and read/write scale here.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>

block: fiops add ioprio support

Add CFQ-like ioprio support. Priority A will get 20% more share than priority A+1, which matches CFQ.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>

block: fiops preserve vios key for deep queue depth workload

If the task has running request, even it's added into service tree newly, we preserve its vios key, so it will not lost its share. This should work for task driving big queue depth. For single depth task, there is no approach to preserve its vios key.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>

block: fiops bias sync workload

If there are async requests running, delay async workload. Otherwise async workload (usually very deep iodepth) will use all queue iodepth and later sync requests will get long delayed. The idea is from CFQ.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>

block: fiops add some trace information

Add some trace information, which is helpful when I do debugging.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
config: enable FIOPS scheduler
block: deadline: Optimize for non-rotational [myfluxi]
block: deadline: allow 0ms deadline latency, increase the read speed [tuxiaobing]

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
kernel/power/powersuspend: cumulative update to version 1.5 [Yank555.lu-faux123]

- fix hybrid-kernel mode cannot be set through sysfs

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend v1.4 (Yank555.lu)

- add hybrid-kernel mode (autosleep and panel, first wins)
- default to hybrid-kernel mode
- harmonize debug message with my other stuff
- include all 3 modes as default, so it's only commenting out to change

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend v1.3 (Yank555.lu)

- fix stupid typo
- add an alternative hook for screen on / off detection in the display panel driver (sleeps ~0.1s sooner, wakes up ~1s later then autosleep)

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend v1.2 (Yank555.lu)

- make kernel / userspace mode switchable

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend v1.1 (Yank555.lu)

- make powersuspend not depend on a userspace initiator anymore, but use a hook in autosleep instead.

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend (faux123)

Android early_suspend/late_resume PM kernel driver framework has been deprecated by Google. This new powersuspend PM kernel driver is a replacement for it and existing early_suspend drivers can be easily adapted to use this new replacement driver

Conflicts:
	include/linux/powersuspend.h
	kernel/power/powersuspend.c
fix