Add LionHeart governor

Change-Id: I57aba8780851a822326fc5deaa03cc17849d845e
block: prepare I/O context code for BFQ-v5r1 for 3.0

BFQ uses struct cfq_io_context to store its per-process per-device data,
reusing the same code for cic handling of CFQ.  The code is not shared
ATM to minimize the impact of these patches.

This patch introduces a new hlist to each io_context to store all the
cic's allocated by BFQ to allow calling the right destructor on module
unload; the radix tree used for cic lookup needs to be duplicated
because it can contain dead keys inserted by a scheduler and later
retrieved by the other one.

Update the io_context exit and free paths to take care also of
the BFQ cic's.

Change the type of cfqq inside struct cfq_io_context to void *
to use it also for BFQ per-queue data.

A new bfq-specific ioprio_changed field is necessary, too, to avoid
clobbering cfq's one, so switch ioprio_changed to a bitmap, with one
element per scheduler.

Signed-off-by: Paolo Valente <paolo.valente@unimore.it>
Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
Signed-off-by: Kasper Hettinga <kasper.hettinga@gmail.com>

Change-Id: I47c1196f96c5c9cd0cee293834d8f444e07153f5
block: cgroups, kconfig, build bits for BFQ-v5r1-3.0

Add a Kconfig option and do the related Makefile changes to compile
the BFQ I/O scheduler.  Also let the cgroups subsystem know about the
BFQ I/O controller.

Signed-off-by: Paolo Valente <paolo.valente@unimore.it>
Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>

Change-Id: If47e10e1fda658ba6b75d12d150a3640fff74714
block: introduce the BFQ-v5r1 I/O sched for 3.0

Add the BFQ-v5r1 I/O scheduler to 3.0.
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 taken a queue is selected and it is 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.

    - High throughput with flash-based devices, 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 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 weights 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>

Change-Id: I8d463321ff53b082e4468f3dbf8fba4a888d6c5e
Enable BFQ

Change-Id: I59917d9f98795277730c56de799d4da2d6dac2e6
Set of BFQ improvements

Taken from fishears
&
Early Queue Merge for BFQ by Paolo

Change-Id: Ic4316e9659eae7882a5f2e5187f6cc26cc97a265
Enable SmartassV2 & Lionheart governors

Change-Id: Ia76527ea4acd0e1212314cadeb240baf769c2e35
Add SavagedZen governor

Change-Id: I73c53dcc99684ee6f8e2d13b72aefb4b29e2b11f
Add OndemandX governor

Change-Id: I00d555e6356ff473523d7daf910d50c31d680d99
Add Aggressive governor

Change-Id: I9c320a78951e6f4d5d7c23b76b2cc398d4729b3e
tmpfs: fix mempolicy object leaks

This patch fixes several mempolicy leaks in the tmpfs mount logic.
These leaks are slow - on the order of one object leaked per mount
attempt.

Leak 1 (umount doesn't free mpol allocated in mount):
    while true; do
        mount -t tmpfs -o mpol=interleave,size=100M nodev /mnt
        umount /mnt
    done

Leak 2 (errors parsing remount options will leak mpol):
    mount -t tmpfs -o size=100M nodev /mnt
    while true; do
        mount -o remount,mpol=interleave,size=x /mnt 2> /dev/null
    done
    umount /mnt

Leak 3 (multiple mpol per mount leak mpol):
    while true; do
        mount -t tmpfs -o mpol=interleave,mpol=interleave,size=100M nodev /mnt
        umount /mnt
    done

This patch fixes all of the above.  I could have broken the patch into
three pieces but is seemed easier to review as one.

Signed-off-by: Greg Thelen <gthelen@google.com>
modified for Mako kernel from LKML reference

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

Change-Id: I0c68c54264bf8e4b7448a30ab320ea052b235333
Set of improvements to Staging-binder

This is a squash of the following commits:
____________________________________________________
Staging: android: fixed a space warning in binder.h

Signed-off-by: Marco Navarra <fromenglish@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
____________________________________________________
Staging: android: binder: Don't call dump_stack in binder_vma_open
Staging: android: binder: Fix crashes when sharing a binder file between processes
Staging: android: binder: Fix memory leak on thread/process exit
Staging: android: binder: Allow using highmem for binder buffers
Staging: android: binder: Fix use-after-free bug

Signed-off-by: Arve HjÃ¸nnevÃ¥g <arve@android.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
____________________________________________________
staging: android: Fix two checkpatch issues in binder.c
staging: android: Avoid using camelcase in binder.h

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
____________________________________________________

Change-Id: Ib710406a2e3039ef8cae186e041c487eb4ef651b
Added optimized ARM RWSEM algorithm

This is a squash of the following commits:
_____________________________________________________
RWSEM implementation for ARM using atomic functions.
ARM: spinlock: use ticket algorithm for ARMv6+ locking implementation
ARM: rwlocks: remove unused branch labels from trylock routines
locking, rwsem: Annotate inner lock as raw
rwsem-spinlock: Implement writer lock-stealing for better scalability
rwsem: Implement writer lock-stealing for better scalability
rwsem: make the waiter type an enumeration rather than a bitmask
rwsem: shorter spinlocked section in rwsem_down_failed_common()
rwsem: move rwsem_down_failed_common code into rwsem_down_{read,write}_failed
rwsem: simplify rwsem_down_read_failed
rwsem: simplify rwsem_down_write_failed
rwsem: more agressive lock stealing in rwsem_down_write_failed
rwsem: use cmpxchg for trying to steal write lock
rwsem: avoid taking wait_lock in rwsem_down_write_failed
rwsem: skip initial trylock in rwsem_down_write_failed
rwsem: simplify __rwsem_do_wake
rwsem: implement support for write lock stealing on the fastpath
rwsem: do not block readers at head of queue if other readers are active

Individual patches signed-off-by: Michel Lespinasse <walken@google.com>
_____________________________________________________

Change-Id: Ieaedaea2ce84dabd716daf8c1b31fab748f85a7b