[PATCH] mm: swaptoken only when swap full
The swap token is only useful in conditions of swap thrash, and actually
worsens the common case by causing more swapping. Make it only have an effect
when swap is more than half full.

-ck
Staging: android: binder: Fix memory leak on thread/process exit

commit 675d66b0ed5fd170d6a44cf8dbb3fa56a5347bdb upstream.

If a thread or process exited while a reply, one-way transaction or
death notification was pending, the struct holding the pending work
was leaked.

Signed-off-by: Arve HjÃ¸nnevÃ¥g <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Staging: android: binder: Allow using highmem for binder buffers

commit 585650dcec88e704a19bb226a34b6a7166111623 upstream.

The default kernel mapping for the pages allocated for the binder
buffers is never used. Set the __GFP_HIGHMEM flag when allocating
these pages so we don't needlessly use low memory pages that may
be required elsewhere.

Signed-off-by: Arve HjÃ¸nnevÃ¥g <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[PATCH] mm: drop swap cache aggressively
While it may be nice to have a copy of pages on swap once written there, the
more garbage we leave in the swapspace the slower any further writes and
reads to and from it are. Just free swapcache whenever we can.

-ck
msm: kgsl: Always submit an interrupt request to the GPU

A context does not have to be present to send an internal dummy
command to the GPU.  Remove BUG() in this case and instead send
a NULL context which will still cause the interrupt to get submitted
to the GPU.

CRs-fixed: 392688
Change-Id: I66b6eebe899ab09e6615d08faddea7ea73de5c6d
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
msm: kgsl: Check for valid pointer before dereferencing

Check to make sure that there is a valid context pointer before
dereferencing it when adding commands to the ringbuffer.

Change-Id: Icf9824de8f62a28cdeeef4378246d9fb334d39fa
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
msm: bam_dmux: handle system wide low memory conditions

When A2 turns on, queue_rx() is first run from the SMSM thread, and
attempts to allocate 32 2kB-buffers with GFP_KERNEL for DMA transactions.
If the system is low on memory, the allocation could put the thread to
sleep while the memory allocator scavenges for enough memory to satisfy
the request.  This is not desired as it stalls a critical system thread
that is communicating with a real-time system.

Instead, use GFP_NOWAIT which will return immediately if no memory is
available for the allocation request so that bam_dmux may handle the
situation gracefully and possibly reschedule the allocations for a later
time.

(cherry picked from commit ad75d8d57e70aab72d1c0c1411f58d1d3028da40)

Change-Id: I43fbaecafc08cd54a663069e4340f46a04e92556
CRs-Fixed: 406946
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/bam_dmux.c
msm: clock-8960: Lower frequency requirements of fpb active votes

We have an active set vote for the multimedia fpb and chip fpb so
that the registers are accessible whenever the processor is
awake. Unfortunately these requests are at the highest rate
supported which is not really necessary to ensure that the buses
are clocking. Lower the rate requests to the fastest speed that
doesn't require increasing voltages to allow the chip to hit low
voltages when the processor is awake.

(cherry picked from commit 9e497f042d8525e57e11d417e9e37c2932a18dbf)

Change-Id: I467d4c09947a0dfe18c06ef046ea3c06c222632d
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
msm: kgsl: Fix adreno idle detection during hang

Adreno idle detection during a hang was being obstructed when
called from adreno_waittimestamp(). The variable active_cnt which
was meant to protect the device from going into suspend while
doing a waittimestamp was being set and was preventing the
check of rbbm_status register which was leading to a false hang
detection, where, if the rbbm_status register value had been
probed the device would have been found to be idle. We fix this by
having a separate function is_adreno_rbbm_status_idle() which checks
this register and report whether the core is idle or not. And we call
this function instead of the generic adreno_isidle() inside
adreno_hang_detect(). Doing this fixes at least one scenario of false
hang detection.

CRs-fixed: 406631

Conflicts:

	drivers/gpu/msm/adreno.c

Change-Id: Ibe80a91513af184bd95c9a710fa696432544621a
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
(cherry picked from commit 91eec5b869d9d187ddab2651449acfe929b3622a)
Revert "msm: cpufreq: fix a race between hotplug and cpufreq"

This reverts commit fe8813238ac857f770deff54b88b7d97144fa9e0.
ARM: mutex: use generic atomic_dec-based implementation for ARMv6+
When reading from large files through the generic file read functions into page cache we can detect when a file is so large that it is unlikely to be fully cached in ram. If that happens we can put it on the tail end of the inactive lru list so it can be the first thing evicted next time we need ram.

Do lots of funny buggers with underscores to preserve most of the existing
APIs.

-ck
When kswapd is awoken due to reclaim by a running task, set the priority of kswapd to that of the calling task thus making memory reclaim cpu activity affected by nice level.

-ck
SHUT THE HELL UP TABLA IS NULL U USELESS MORON LOG.  Jordan RULES
msm_mdp4:LJA: add perf_request var and backup sequence to prevent pip errors
msm_mdp4:LJA: add missing vsync_irq_disable for corresponding vsync_irq_enable for mdp4_dsi_video_wait4dmap_done() func
Revert "msm_mdp4:LJA: add perf_request var and backup sequence to prevent pip errors"

This reverts commit 3502a8fb5a815084075eb612aae10885b6972ae1.
msm_mdp4:LJA: do not allow pipe to be accessed if it is NULL
msm_mdp4:LJA: add missing mdp4_overlay_iommu_unmap_freelist
msm_mdp4:LJA: upgrade smart_mtp_s6 file to LJA