prepare kernel for some mods I want to try
Linux 3.0.82

Signed-off-by: sultanxda <sultanxda@gmail.com>
merged in Linux 3.0.82 patch
ARM: decompressor: Enable unaligned memory access for v6 and above

Modern GCC can generate code which makes use of the CPU's native
unaligned memory access capabilities.  This is useful for the C
decompressor implementations used for unpacking compressed kernels.

This patch disables alignment faults and enables the v6 unaligned
access model on CPUs which support these features (i.e., v6 and
later), allowing full unaligned access support for C code in the
decompressor.

The decompressor C code must not be built to assume that unaligned
access works if support for v5 or older platforms is included in
the kernel.

For correct code generation, C decompressor code must always use
the get_unaligned and put_unaligned accessors when dealing with
unaligned pointers, regardless of this patch.

Signed-off-by: Dave Martin <dave.martin@linaro.org>
Acked-by: Nicolas Pitre <nico@linaro.org>
mmc: core: Fix possbile memory leak Fix possible memory leak detected by kmemleak:

unreferenced object 0xc0f80f00 (size 64):
  comm "swapper/0", pid 1, jiffies 4294937508 (age 82.980s)
  hex dump (first 32 bytes):
    6d 6d 63 30 5f 64 65 74 65 63 74 00 72 79 2e 68  mmc0_detect.ry.h
    00 07 00 00 68 77 63 61 70 2e 68 00 02 00 00 70  ....hwcap.h....p
  backtrace:
    [<c010a1fc>] __kmalloc+0x164/0x220
    [<c01e1630>] kvasprintf+0x38/0x58
    [<c01e1668>] kasprintf+0x18/0x24
    [<c02fcf60>] mmc_alloc_host+0x114/0x1b4
    [<c0311c84>] msmsdcc_probe+0xc14/0x1fd8
    [<c022b40c>] platform_drv_probe+0x14/0x18
    [<c022a144>] driver_probe_device+0x144/0x334
    [<c022a394>] __driver_attach+0x60/0x84
    [<c022884c>] bus_for_each_dev+0x4c/0x78
    [<c0229720>] bus_add_driver+0xd0/0x250
    [<c022a884>] driver_register+0x9c/0x128
    [<c00086bc>] do_one_initcall+0x90/0x160
    [<c06d1904>] kernel_init+0xe8/0x1a4
    [<c000ee4c>] kernel_thread_exit+0x0/0x8
    [<ffffffff>] 0xffffffff

Change-Id: I3b29d71463af849a072cabbe56637adf6db6d0da
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
backport lowmemorykiller from Google android kernel 3.4
lowmemorykiller: make default lowmemorykiller debug message useful

lowmemorykiller debug messages are inscrutable and mostly useful
for debugging the lowmemorykiller, not explaining why a process
was killed.  Make the messages more useful by prefixing them
with "lowmemorykiller: " and explaining in more readable terms
what was killed, who it was killed for, and why it was killed.

The messages now look like:
[   76.997631] lowmemorykiller: Killing 'droid.gallery3d' (2172), adj 1000,
[   76.997635]    to free 27436kB on behalf of 'kswapd0' (29) because
[   76.997638]    cache 122624kB is below limit 122880kB for oom_score_adj 1000
[   76.997641]    Free memory is -53356kB above reserved

A negative number for free memory above reserved means some of the
reserved memory has been used and is being regenerated by kswapd,
which is likely what called the shrinkers.

Change-Id: I1fe983381e73e124b90aa5d91cb66e55eaca390f
Signed-off-by: Colin Cross <ccross@android.com>
lib/string: use glibc version
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>
Added optimized ARM RWSEM algorithm

Author:    Ezekeel <Ezekeel@gmail.com>
resolving conflict with Johnnyslts dynamicreadahead.
rwsem: steal writing sem for better performance
Commit 5a50508 changes to rwsem from mutex, caused aim7 fork_test
performance to dropped 50%. Yuanhan liu did an analysis, found it was
caused by strict sequential writing. Ingo suggest stealing sem writing from
front task in wait queue. https://lkml.org/lkml/2013/1/29/84

So does this patch.
In this patch, I just allow write stealing to happen when the first waiter
is also writer. The performance fully is now fully recovered.

Reported-by: lkp@linux.intel.com
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Alex Shi <alex.shi@intel.com>
sched: disable gentle fair sleepers
msm: smd: Add SMSM state queue

To reduce the chance of missing SMSM state transitions,
push the SMSM state into a queue in the interrupt handler
and then pull the state for processing the in callback
workqueue.

Change-Id: Ib66bc15f7445369ea7ad2ca271a79ac10b8105a0
CRs-Fixed: 323725
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
msm: smd: add separate return code if SMD port is closing

Add EAGAIN return code if SMD port has been allocated, but
is currently pending a remote close.  This allows the client
to differentiate between ENODEV (port doesn't exist)
and EAGAIN (port not ready to be opened).

(cherry picked from commit bb2b1faf7d0fd51457e6fc452eef6c52f2023c64)

Change-Id: I1b057c0e3cc36b87f2d724325304ec941fcdb536
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
msm: smsm: Add SMSM notifier wakelock.

CRs-Fixed : 345581

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
(cherry picked from commit ff461d9d828499fec86b269cc65a3cfed8c5aaac)

Change-Id: I24845f52271fa98c36ec026bbf182240e965270a
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm: smsm: Add SMSM notifier wakelock

Add wakelock that is locked in the SMSM interrupt handler and unlocked
in the workqueue after notifications have been completed.

This prevents the sleep code from putting the system to sleep before the
SMSM notification workqueue gets scheduled.

Change-Id: I45c4bc210d638ebccfecef883bb62abfbf9f2a1b
CRs-Fixed: 345581
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
msm: smd: Remove duplicate variable definitions

Remove duplicate local variable definitions that cause
variable aliasing and could result in accessing a null
pointer when dealing with open-close-open race
condition.

Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
(cherry picked from commit 724f317cf6176d0a48a994d0f98a4fb73019e3ce)

Change-Id: Ia891810ab42aa214a12fc7be7a09ed34dfdef387
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm: smd: Do not use wakelock for local DEM notifications

Notify local SMSM callback clients without using a wakelock since SMSM
signaling is used by power management during power-down/-up sequencing
on DEM-based targets.  Grabbing a wakelock in this case will abort
power-down sequencing.

(cherry picked from commit da31d046ba0c5d3d1f674e9d35a39e9d0e4ae4df)

Change-Id: I1f7e3a3ae049573baaf8866efd79ad324a248f61
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
(cherry picked from commit 2240228f3be50b8a0ebd60d5f36cf6314f156404)
(cherry picked from commit 32c89ee88b9e1f020ba075d3688afb4d99033799)

Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>
msm: smsm: Fix race condition in SMSM notification

The SMSM snapshot logic takes a snapshot of the current SMSM state,
places it into a FIFO, increments a wakelock count, and then signals a
worker to process the state changes.  The worker processes the state
changes and then decrements the wakelock count.

In the previous case, the code would do the following:

Interrupt handler:
 1) insert data into FIFO
 2) increment wakelock count

Worker:
 a) verifies >= 1 snapshots are in FIFO
 b) processes snapshot
 c) decrements wakelock reference count

If the interrupt handler is interrupted between steps 1 and 2, then the
function flow would be 1abc2.  In this case, step c would fail because
the wakelock count would be zero and the wakelock would remain at 1 and
locked even though the FIFO would be empty.  This results in the
wakelock not getting released.

To resolve this, the order of 2 (now 1') and 1 (now 2') was swapped
which always ensures 1' will always occur before abc which results in
the proper ordering 1'2'abc.

CRS-Fixed: 349099
Change-Id: I388b4c2f76838f59337e94f83b65fa06e81bb875
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
(cherry picked from commit 96b55f6ec25d5812a0492fc39b6b44a6141795d2)
(cherry picked from commit 8c17b69afa7f2b7eb10df635f984b15d08c71da5)

Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>