staging/android: use module_platform_driver

as the init and exit functions just do a platform_driver_register and
platform_driver_unregister, and nothing else, so its better to
use the module_platform_driver macro rather replicating its implementation

Signed-off-by: Devendra Naga <develkernel412222@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
lowmemorykiller: Account for highmem during kswapd reclaim

Currenlty most memory reclaim is done through kswapd.
Since kswapd uses a gfp mask of GFP_KERNEL, and because
the lowmemorykiller is zone aware, the lowmemorykiller will
ignore highmem most of the time.
This results in the lowmemorykiller being overly aggressive.

The fix to this issue is to allow the lowmemorykiller to
count highmem when being called by the kswapd if the lowmem
watermarks are satisfied.

Change-Id: I938644584f374763d10d429d835e74daa4854a38
Signed-off-by: Liam Mark <lmark@codeaurora.org>
cpufreq: governors: Remove duplicate check of target freq in supported range

Function __cpufreq_driver_target() checks if target_freq is within
policy->min and policy->max range. generic_powersave_bias_target() also
checks if target_freq is valid via a cpufreq_frequency_table_target()
call. So, drop the unnecessary duplicate check in *_check_cpu().

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Conflicts:
	drivers/cpufreq/cpufreq_conservative.c
	drivers/cpufreq/cpufreq_ondemand.c
ext4: speed up truncate/unlink by not using bforget() unless needed

Do not iterate over data blocks scanning for bh's to forget as they're
never exist. This improves time taken by unlink / truncate syscall.
Tested by continuously truncating file that is being written by dd.
Another test is rm -rf of linux tree while tar unpacks it. With
ordered data mode condition unlikely(!tbh) was always met in
ext4_free_blocks. With journal data mode tbh was found only few times,
so optimisation is also possible.

Unlinking fallocated 60G file after doing sync && echo 3 >
/proc/sys/vm/drop_caches && time rm --help

X86 before (linux 3.6-rc4):
# time rm -f test1
real    0m2.710s
user    0m0.000s
sys     0m1.530s

X86 after:
# time rm -f test1
real    0m0.644s
user    0m0.003s
sys     0m0.060s

MIPS before (linux 2.6.37):
# time rm -f test1
real    0m 4.93s
user    0m 0.00s
sys     0m 4.61s

MIPS after:
# time rm -f test1
real    0m 0.16s
user    0m 0.00s
sys     0m 0.06s

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Andrey Sidorov <qrxd43@motorola.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
net: loopback: set default mtu to 64K

loopback current mtu of 16436 bytes allows no more than 3 MSS TCP
segments per frame, or 48 Kbytes. Changing mtu to 64K allows TCP
stack to build large frames and significantly reduces stack overhead.

Performance boost on bulk TCP transferts can be up to 30 %, partly
because we now have one ACK message for two 64KB segments, and a lower
probability of hitting /proc/sys/net/ipv4/tcp_reordering default limit.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
gpu: ion: Return error value when iommu map fails

When __ion_map_iommu returns a non-zero value (i.e.
error occured), properly propagate this error back
up to the client.

Change-Id: I6cd5ce8a723ad1cbbd6c42b712f5a19fa2ba719f
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
ion: remove ion_share_set_flags

Due to changes in the semantics of the `flags' field of `struct
ion_buffer', it is no longer necessary to set the flags when setting
up an ion share.

Change-Id: I2f34868cc6d2045f78dbd5f0a67d3e40778af0de
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
gpu: ion: Fix a contiguous system heap crash

map_kernel and unmap_kernel in kmalloc_ops should support
a contiguous heap. The existing functions
ion_system_heap_map_kernel and ion_system_heap_unmap_kernel
are geared towards discontiguous memory (supported via
vmalloc_ops) and crash while handling contiguous heaps. This
patch adds two new functions specific to contiguous system
heaps to initialize kmalloc_ops.

Change-Id: I48d30ca01c5a0b71af4e1e640c79a920a298aedb
Acked-by: Jennifer L. Zenner <jzenner@qti.qualcomm.com>
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
gpu: ion: Free heaps after checking for overlap

The platform data needs to be freed after checking for overlaps,
otherwise a use after free bug occurs.

Change-Id: I3b75e9573d3f6608312e63c56f52daaebfc51b4c
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
ion: tracing: add ftrace events for ion allocations

Add ftrace events for ion allocations to make it easier to profile
their performance.

Change-Id: I9f32e076cd50d7d3a145353dfcef74f0f6cdf8a0
Signed-off-by: Liam Mark <lmark@codeaurora.org>
ion: cma: Add debug heap ops for CMA heap

For tracking CMA allocation by address and fragmentation
(if any), add debug heap ops which gives buffer allocation
info.

Change-Id: Ia8bed38034b85b2d4dcf84811a348bbbe50dc16b
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>
gpu: ion: add pointer null checks in map and unmap

Clients may pass incorrect arguments to ION causing crashes.
Add checks to validate input for ION APIs.

Change-Id: Idafa4535b3ef71184ca11fb2c0c4ab073a52ac2f
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>

Conflicts:
	drivers/gpu/ion/ion.c
msm: iommu: re-use existing buffers for `extra' mappings

There is a bug on some hardware that requires us to overmap Iommu
mappings by 2x. Currently, we set aside a dummy buffer onto which we
map all of these dummy mappings. In general, for large mappings it's
nice to use the more efficient iommu_map_range instead of calling
iommu_map repeatedly. However, with our current approach in
msm_iommu_map_extra we can't use iommu_map_range for page_sizes larger
than the dummy buffer. To avoid wasting memory by increasing the size
of the dummy buffer, we can simply remap on top of the the buffer
being mapped in the first place. Since the second mapping should never
be used (besides by the buggy hardware) this should not be a problem.

Re-use existing buffers for all `extra' mappings. Essentially, map the
same physical address range twice. To be extra safe, make the second
mapping read-only.

Change-Id: I35462ad50de8da1f2befa3e3f0895925535cdc98
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
gpu: ion: remove stale variable

Tracking the number of user mappings should be done in the Ion
heaps. Remove the variable that was used to track this in core Ion.

Change-Id: I715280515e3010bd002314aefe0ec8cdb37c143d
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
gpu: ion: check for leaks in ion_client_destroy

If an ion client is destroyed without destroying all handles created
by that client, there will be leaked buffers. Print a message if this
happens.

Change-Id: Id674f508666d506b3a9ee848adbc29435c5fe8c2
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
gpu: ion: Remove get_flags ioctl

There are no callers of the get flags ioctl. Remove it
before anyone tries to use it again.

Change-Id: I857ef705fc864cce49f671124b96bd9f47b66ab2
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
msm: Add support for ION Flushing without virtual address

Video has very large buffers to be flushed. Due to lack of
vmalloc space, ion_map_kernel cannot be called on each of
the video buffers. With this change the ion handle can be
flushed without the need of the kernel mapping.

Change-Id: If026f21e44a2cce6c2b8c232fc80a69d0dabcd14
Signed-off-by: Neeti Desai <neetid@codeaurora.org>

Conflicts:

	drivers/gpu/ion/ion_cp_heap.c
	drivers/gpu/ion/msm/msm_ion.c

Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
gpu: ion: enable the kmalloc heap

There are some Ion clients who would like to use the kmalloc
heap. Enable it.

Change-Id: Ie818be9e1211d52d489ad2cb63d94e2fddfc0f01
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
gpu: ion: minor refactor in ion_mmap

mutex_unlock is being called in the if and the else branch. Just move
it out of the if/else. This will help reduce upcoming merge conflicts
with upstream Ion changes.

Change-Id: Ib426e73f1cb9ed79f37b9c1e0a8885066ae5b4f4
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
gpu: ion: Align va address to biggest buffer size

Align the virtual address to the max buffer size to
allow IOMMU mappings at the biggest buffer size.

Change-Id: I74ba665c1782e2f0631274766c5caeeb192224e0
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>