lowmemorykiller: Compact memory when killing processes

* Memory compaction is never invoked on Android because we avoid swap
   and don't allocate huge pages. Fix it by invoking compaction from the LMK when
   a process is killed to reduce memory fragmentation.

Change-Id: I2bda790c2093e65fd6f43d52ea5149d6b57cb1e9

Conflicts:

	drivers/staging/android/lowmemorykiller.c

Conflicts:
	drivers/staging/android/lowmemorykiller.c

Signed-off-by: Rohan Mathur <rohanmathur34@gmail.com>
Signed-off-by: Syukri Lajin <ginger_boy92@hotmail.com>
mach-tegra: cpu-tegra3.c: lp to g delay to 1000ms for battery life

Signed-off-by: Syukri Lajin <ginger_boy92@hotmail.com>
lowmemorykiller: Compact memory when killing processes

* Memory compaction is never invoked on Android because we avoid swap
   and don't allocate huge pages. Fix it by invoking compaction from the LMK when
   a process is killed to reduce memory fragmentation.

Change-Id: I2bda790c2093e65fd6f43d52ea5149d6b57cb1e9

Conflicts:

	drivers/staging/android/lowmemorykiller.c

Conflicts:
	drivers/staging/android/lowmemorykiller.c

Signed-off-by: Rohan Mathur <rohanmathur34@gmail.com>
Signed-off-by: Syukri Lajin <ginger_boy92@hotmail.com>
mach-tegra: cpu-tegra3.c: lp to g delay to 1000ms for battery life

Signed-off-by: Syukri Lajin <ginger_boy92@hotmail.com>
Revert "lowmemorykiller: Compact memory when killing processes"

This reverts commit e3d215896b2e747e35d8d65f804c4804afacd98c.
defconfig update

Change-Id: I21239011f91e2d35928e498e874ffcef650bfafa
block: cgroups, kconfig, build bits for BFQ-v6r2-3.10

Update Kconfig.iosched and do the related Makefile changes to include
kernel configuration options for BFQ. Also add the bfqio controller
to the cgroups subsystem.

Signed-off-by: Paolo Valente <paolo.valente@unimore.it>
Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
Signed-off-by: Matteo Bernardini <matteo.bernardini@gmail.com>
Signed-off-by: Syukri Lajin <ginger_boy92@hotmail.com>
block: introduce the BFQ-v6r2 I/O sched for 3.10

Add the BFQ-v6r2 I/O scheduler to 3.10.
The general structure is borrowed from CFQ, as much code. A (bfq_)queue
is associated to each task doing I/O on a device, and each time a
scheduling decision has to be made a queue is selected and served until
it expires.

    - Slices are given in the service domain: tasks are assigned
      budgets, measured in number of sectors. Once got the disk, a task
      must however consume its assigned budget within a configurable
      maximum time (by default, the maximum possible value of the
      budgets is automatically computed to comply with this timeout).
      This allows the desired latency vs "throughput boosting" tradeoff
      to be set.

    - Budgets are scheduled according to a variant of WF2Q+, implemented
      using an augmented rb-tree to take eligibility into account while
      preserving an O(log N) overall complexity.

    - A low-latency tunable is provided; if enabled, both interactive
      and soft real-time applications are guaranteed very low latency.

    - Latency guarantees are preserved also in presence of NCQ.

    - Also with flash-based devices, a high throughput is achieved while
      still preserving latency guarantees.

    - Useful features borrowed from CFQ: cooperating-queues merging (with
      some additional optimizations with respect to the original CFQ version),
      static fallback queue for OOM.

    - BFQ supports full hierarchical scheduling, exporting a cgroups
      interface.  Each node has a full scheduler, so each group can
      be assigned its own ioprio (mapped to a weight, see next point)
      and an ioprio_class.

    - If the cgroups interface is used, weights can be explictly
      assigned, otherwise ioprio values are mapped to weights using the
      relation weight = IOPRIO_BE_NR - ioprio.

    - ioprio classes are served in strict priority order, i.e., lower
      priority queues are not served as long as there are higher
      priority queues.  Among queues in the same class the bandwidth is
      distributed in proportion to the weight of each queue. A very
      thin extra bandwidth is however guaranteed to the Idle class, to
      prevent it from starving.

Signed-off-by: Paolo Valente <paolo.valente@unimore.it>
Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
Signed-off-by: Syukri Lajin <ginger_boy92@hotmail.com>
block, bfq: add Early Queue Merge (EQM) to BFQ-v6r2 for 3.10.0

A set of processes may happen  to  perform interleaved reads, i.e., requests
whose union would give rise to a  sequential read  pattern.  There   are two
typical  cases: in the first  case,   processes  read  fixed-size  chunks of
data at a fixed distance from each other, while in the second case processes
may read variable-size chunks at  variable distances. The latter case occurs
for  example with  KVM, which  splits the  I/O generated  by the  guest into
multiple chunks,  and lets these chunks  be served by a  pool of cooperating
processes,  iteratively  assigning  the  next  chunk of  I/O  to  the  first
available  process. CFQ  uses actual  queue merging  for the  first type  of
processes, whereas it  uses preemption to get a sequential  read pattern out
of the read requests  performed by the second type of  processes. In the end
it uses  two different  mechanisms to  achieve the  same goal:  boosting the
throughput with interleaved I/O.

This patch introduces  Early Queue Merge (EQM), a unified mechanism to get a
sequential  read pattern  with both  types of  processes. The  main idea  is
checking newly arrived requests against the next request of the active queue
both in case of actual request insert and in case of request merge. By doing
so, both the types of processes can be handled by just merging their queues.
EQM is  then simpler and  more compact than the  pair of mechanisms  used in
CFQ.

Finally, EQM  also preserves the  typical low-latency properties of  BFQ, by
properly restoring the weight-raising state of  a queue when it gets back to
a non-merged state.

Signed-off-by: Mauro Andreolini <mauro.andreolini@unimore.it>
Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
Reviewed-by: Paolo Valente <paolo.valente@unimore.it>
Signed-off-by: Syukri Lajin <ginger_boy92@hotmail.com>
Revert "block, bfq: add Early Queue Merge (EQM) to BFQ-v6r2 for 3.10.0"

This reverts commit de88e08f3a5a55465650a67ed608c602c377e69b.
Revert "block: introduce the BFQ-v6r2 I/O sched for 3.10"

This reverts commit 5571e21f49fa7356a0ded59890b6526e9c7972de.
Revert "block: cgroups, kconfig, build bits for BFQ-v6r2-3.10"

This reverts commit 021e13206219afa4b16beb5d0fbfb2d11b2e94ba.
defconfig

Change-Id: Id80b57cd3558580c6b2f484d806c17e6c737a7d1
Merge branch 'ahb' into franco_try