Colin Cross [Fri, 20 Dec 2013 02:37:49 +0000 (18:37 -0800)]
ion: fix overflow and list bugs in system heap
Fix a few bugs in ion_system_heap:
Initialize the list node in the info block.
Don't store size_remaining in a signed long, allocating >2GB
could overflow, resulting in a call to sg_alloc_table with
nents=0 which panics. alloc_largest_available will never
return a block larger than size_remanining, so it can never
go negative.
Limit a single allocation to half of all memory. Prevents a
large allocation from taking down the whole system.
Change-Id: I7fcbd7e1d5b4d482d7612d80b6c9e8e24466f1d8
Signed-off-by: Colin Cross <ccross@android.com>
Mitchel Humpherys [Tue, 6 Aug 2013 22:08:23 +0000 (15:08 -0700)]
ion: Add private buffer flag to skip page pooling on free
Currently, when we free a buffer it might actually just go back into a
heap-specific page pool rather than going back to the system. This poses
a problem because sometimes (like when we're running a shrinker in low
memory conditions) we need to force the memory associated with the
buffer to truly be relinquished to the system rather than just going
back into a page pool.
There isn't a use case for this flag by Ion clients, so make it a
private flag. The main use case right now is to provide a mechanism for
the deferred free code to force stale buffers to bypass page pooling.
Change-Id: I724f89cc037083fe8576784363caa18a34e8705a
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Mitchel Humpherys [Mon, 7 Oct 2013 16:24:29 +0000 (09:24 -0700)]
gpu: ion: make sure all clients are exposed in debugfs
Currently, if multiple Ion clients are created with the same name, only
the first one shows up in debugfs. Rectify this by adding a
monotonically-increasing serial number to the debug names of Ion
clients.
Change-Id: I000e45055d5029c7bccd88c36b238736929da3a5
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Mitchel Humpherys [Thu, 19 Dec 2013 06:10:07 +0000 (22:10 -0800)]
ion: store a copy of the client name on client creation
Currently, we copy the pointer passed in to ion_client_create without
making a copy of the string itself. This approach is problematic since
it relies on the client keeping the name string in working order.
Change-Id: I62d79c7539b2c857a5a625339d49c9c892e8622d
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Laura Abbott [Mon, 5 Dec 2011 23:32:36 +0000 (15:32 -0800)]
gpu: ion: Fix debugfs handling of multiple kernel clients
Currently, Ion registers all debugfs entries for clients
via pid. If there are multiple kernel clients, this means
the debugfs entry only gets created for the first one. Fix
this by creating debugfs entries by name always. When
creating user clients, specify the name via the pid.
Change-Id: I00cbb284d1c53b3362bb7be9c0275620a9fac167
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Mitchel Humpherys [Thu, 29 Aug 2013 22:28:58 +0000 (15:28 -0700)]
gpu: ion: create separate heap and client debugfs directories
It can be slightly annoying to figure out which files under the ion
debugfs directory are heap debug files and which ones are client debug
files. Create separate subdirectories under ion to hold the different
types of debug files.
Change-Id: Ic773ab619ef94b9b4d0f3794def9d37645c7c212
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Colin Cross [Fri, 13 Dec 2013 01:50:35 +0000 (17:50 -0800)]
ion: move shrinker out of heaps
Every heap that uses deferred frees is going to need a shrinker
to shrink the freelist under memory pressure. Rather than
requiring each heap to implement a shrinker, automatically
register a shrinker if the deferred free flag is set.
The system heap also needs to shrink its page pools, so add
a shrink function to the heap ops that will be called after
shrinking the freelists.
Change-Id: Icda722d683426fadb8ddd1c8e9499264ab682c57
Signed-off-by: Colin Cross <ccross@android.com>
John Stultz [Thu, 19 Dec 2013 23:56:23 +0000 (15:56 -0800)]
ion_test: Add compat_ioctl support (v2)
Prior to subitting this, Colin reworked the compat_ioctl support
for the ion_test driver, moving the structure to be the same size
on both 32 and 64 bit architectures.
Two small things were left out. The compat_ioctl ptr assignment,
and the fact that despite having uniform sized types in the
structure, the structure pads out to different sizes on different
arches.
This patch resolves this issue by adding a padding entry after
the write flag, and adding the compat_ioctl ptr.
Changes in v2:
- Add a padding int rather then making write a u64
Cc: Colin Cross <ccross@android.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
John Stultz [Wed, 18 Dec 2013 01:04:29 +0000 (17:04 -0800)]
staging: ion: Avoid using rt_mutexes directly
RT_MUTEXES can be configured out of the kernel, causing compile
problems with ION.
To quote Colin:
"rt_mutexes were added with the deferred freeing feature. Heaps need
to return zeroed memory to userspace, but zeroing the memory on every
allocation was causing performance issues. We added a SCHED_IDLE
thread to zero memory in the background after freeing, but locking the
heap from the SCHED_IDLE thread might block a high priority allocation
thread for a long time.
The lock is only used to protect the heap's free_list and
free_list_size members, and is not held for any long or sleeping
operations. Converting to a spinlock should prevent priority
inversion without using the rt_mutex. I'd also rename it to free_lock
to so it doesn't get used as a general heap lock."
Thus this patch converts the rt_mutex usage to a spinlock and
renames the lock free_lock to be more clear as to its use.
I also had to change a bit of logic in ion_heap_freelist_drain()
to safely avoid list corruption.
Acked-by: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Reported-by: Jim Davis <jim.epost@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
John Stultz [Tue, 17 Dec 2013 05:07:52 +0000 (21:07 -0800)]
staging: ion: Fix possible null pointer dereference
The kbuild test robot reported:
drivers/staging/android/ion/ion_system_heap.c:122 alloc_largest_available() error: potential null dereference 'info'. (kmalloc returns null)
Where the pointer returned from kmalloc goes unchecked for failure.
This patch checks the return for NULL, and reworks the logic, as
suggested by Colin, so we allocate the page_info structure first.
Acked-by: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
John Stultz [Tue, 17 Dec 2013 05:07:51 +0000 (21:07 -0800)]
staging: ion: Add HAVE_MEMBLOCK config dependency
The kbuild test robot reported a build issue w/ ION on m68k:
drivers/staging/android/ion/ion.c: In function 'ion_reserve':
drivers/staging/android/ion/ion.c:1526:4: error: implicit declaration of function 'memblock_alloc_base' [-Werror=implicit-function-declaration]
drivers/staging/android/ion/ion.c:1528:11: error: 'MEMBLOCK_ALLOC_ANYWHERE' undeclared (first use in this function)
drivers/staging/android/ion/ion.c:1528:11: note: each undeclared identifier is reported only once for each function it appears in
drivers/staging/android/ion/ion.c:1537:4: error: implicit declaration of function 'memblock_reserve' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
This is caused by ION using memblock functionality which m68k doesn't support.
This patch adds a HAVE_MEMBLOCK dependency to the ION config.
Acked-by: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wei Yongjun [Tue, 17 Dec 2013 03:20:22 +0000 (11:20 +0800)]
gpu: ion: fix sparse non static symbol warnings
Fixes the following sparse warnings:
drivers/staging/android/ion/tegra/tegra_ion.c:23:19: warning:
symbol 'idev' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:24:19: warning:
symbol 'tegra_user_mapper' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:25:5: warning:
symbol 'num_heaps' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:26:17: warning:
symbol 'heaps' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:28:5: warning:
symbol 'tegra_ion_probe' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:66:5: warning:
symbol 'tegra_ion_remove' was not declared. Should it be static?
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wei Yongjun [Tue, 17 Dec 2013 03:16:41 +0000 (11:16 +0800)]
gpu: ion: use module_platform_driver to simplify the code
module_platform_driver() makes the code simpler by eliminating
boilerplate code.
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Zhangfei Gao [Sun, 9 Jun 2013 03:08:32 +0000 (11:08 +0800)]
gpiolib: remove warnning of allocations with IRQs disabled
Move of_gpiochip_add outof spin_lock, since kzalloc inside
of_gpiochip_add -> of_gpiochip_add_pin_range -> gpiochip_add_pin_range -> kzalloc
WARNING: at kernel/lockdep.c:2740 lockdep_trace_alloc+0xf8/0xfc()
DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags))
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Michael Wright [Wed, 4 Dec 2013 23:23:41 +0000 (15:23 -0800)]
android: configs: Add HIDRAW to recommended set
The Logitech unifying driver depends on hidraw being available.
Recommending one without the other will cause the Logitech driver to
silently fail when connecting Logitech devices.
Change-Id: I92ed2b6803537d9da6eed7fcada8f329cb4469a2
Signed-off-by: Michael Wright <michaelwr@google.com>
Alexandre Courbot [Fri, 4 Oct 2013 17:59:57 +0000 (10:59 -0700)]
gpiolib: safer implementation of desc_to_gpio()
The current implementation of desc_to_gpio() relies on the chip pointer
to be set to a valid value in order to compute the GPIO number. This
was done in the hope that we can get rid of the gpio_desc global array,
but this is not happening anytime soon.
This patch reimplements desc_to_gpio() in a fashion similar to that of
gpio_to_desc(). As a result, desc_to_gpio(gpio_to_desc(gpio)) == gpio is
now always true. This allows to call desc_to_gpio() on non-initialized
descriptors as some error-handling code currently does.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reported-by: Dr. H. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
John Stultz [Fri, 13 Dec 2013 03:09:47 +0000 (19:09 -0800)]
ion: Fix build warning
Add #include <linux/device.h> to fix the following warning seen
with gcc 4.7.3:
In file included from drivers/staging/android/ion/ion_heap.c:26:0:
drivers/staging/android/ion/ion_priv.h:358:21: warning: ‘struct device’ declared inside parameter list [enabled by default]
drivers/staging/android/ion/ion_priv.h:358:21: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
Change-Id: Icc249b32d877a5b76b1669c99bef2b05d9e322da
Signed-off-by: John Stultz <john.stultz@linaro.org>
Colin Cross [Tue, 17 Dec 2013 00:33:00 +0000 (16:33 -0800)]
ion: remove ion_user_handle_t from ion_test.h
ion_test.h should not define ion_user_handle_t, and defining it
causes a warning:
In file included from drivers/staging/android/ion/ion_test.c:31:
drivers/staging/android/ion/../uapi/ion_test.h:23: error: redefinition of typedef 'ion_user_handle_t'
drivers/staging/android/ion/../uapi/ion.h:23: note: previous declaration of 'ion_user_handle_t' was here
Change-Id: I541897745a5ff128790a7e51b23f3034f5d3d6d9
Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Colin Cross <ccross@android.com>
John Stultz [Sat, 14 Dec 2013 20:06:45 +0000 (12:06 -0800)]
ion: Don't allow building ION as a module.
ION doesn't export the proper symbols for it to be a module. This
causes build issues when ION is configured as a module.
Since Andorid kernels rarely use modules (I think recent policy
requires no modules?), go ahead and set the ION config to a bool
from the tristate option.
If folks decide ION as a module is important, we will have to go
through and export the various needed symbols.
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Greg Hackmann [Fri, 13 Dec 2013 21:02:31 +0000 (13:02 -0800)]
timerfd: support CLOCK_BOOTTIME clock
Add CLOCK_BOOTTIME support to timerfd
Change-Id: I14dee6d1104f15a05f463a632268ac4564753faf
Signed-off-by: Greg Hackmann <ghackmann@google.com>
JP Abgrall [Sat, 23 Nov 2013 01:29:57 +0000 (17:29 -0800)]
android: configs: require TCPMSS, remove SCHED_TRACER and TIMER_STATS
TCPMSS is required for the Android Vpn service to correctly
handle the MTU on tun/ppp devices. Bug:
11579326
We don't really need SCHED_TRACER and the TIMER_STATS.
Change-Id: I10c5767a6324a496713752d4fe9eff361dc8e06a
(cherry picked from commit
23f01e8e81f3c53985958fa291b39c84293ad047)
John Stultz [Fri, 8 Nov 2013 03:58:41 +0000 (19:58 -0800)]
ion: Improve ION config description
Mostly just to quiet checkpatch warnings, be more verbose
in describing the ION config option.
Change-Id: I194235f1a68623dca15ae6e658fc99d00943a827
Signed-off-by: John Stultz <john.stultz@linaro.org>
John Stultz [Fri, 8 Nov 2013 03:51:09 +0000 (19:51 -0800)]
ion: Cleanup whitespace issues and other checkpatch problems
Just some simple cleanups to address whitespace issues and
other issues found w/ checkpatch.
Change-Id: I181444505627894b8f3bbf59192703b0f65736ee
Signed-off-by: John Stultz <john.stultz@linaro.org>
JP Abgrall [Fri, 22 Nov 2013 22:07:03 +0000 (14:07 -0800)]
android: configs: Reorder config fragments, update README
Change-Id: I5ee4b794dcc00f74f26562e49a406ea292af63ee
(cherry picked from commit
9ebedefd06142c9bc812bfa23401031525002a76)
Colin Cross [Wed, 27 Nov 2013 23:53:21 +0000 (15:53 -0800)]
ion: fix bugs in cma heap
Implement ion_cma_unmap_kernel, ion will call it unconditionally.
Use correct gfp flags when calling dma_alloc_coherent so it doesn't
try to use atomic DMA memory.
Check for invalid alignment when allocating.
Reject cached allocations - the cpu address returned by
dma_alloc_coherent is always going to be an uncached mapping, so
map_kernel will not see data written by a cached userspace mapping.
Change-Id: I2ea03f28fae3749f6de0b89700b69da3845926ea
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Wed, 27 Nov 2013 23:53:01 +0000 (15:53 -0800)]
ion: add alignment check to chunk heap
Change-Id: I4be12b9545a81f9b46339a905f00e1e64896b3ed
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Wed, 27 Nov 2013 23:51:02 +0000 (15:51 -0800)]
ion: add helper to zero contiguous region of pages
Add ion_heap_pages_zero for ion heaps to use to zero pages
during initialization or allocation, when a struct ion_buffer
may not be available. Use it from the chunk heap and carveout
heaps.
Change-Id: Ic6c921943a8820cf9896da5164f2d9794d0fe91f
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Wed, 27 Nov 2013 05:36:54 +0000 (21:36 -0800)]
ion: carveout heap: zero buffers on free, fix memory leak
The carveout heap wasn't zeroing its buffers after use.
Create the sg_table during allocate instead of map_dma, to allow
using the sg_table during free, and call ion_heap_buffer_zero
during free. Also fixes a missing kfree when destroying the
table.
Change-Id: I318a8493cce32580250884cae336dd2e2c28e73b
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Wed, 27 Nov 2013 05:25:47 +0000 (21:25 -0800)]
ion: fix sparse warnings
Fix sparse warnings in ion.
Change-Id: Icbadf2ca53bea20914f608f619568629c178eae3
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Tue, 26 Nov 2013 23:35:29 +0000 (15:35 -0800)]
ion: use alloc_pages in system contig heap
There is no reason to use kzalloc, just call alloc_pages directly.
Change the GFP from GFP_KERNEL to include __GFP_HIGH, to allow it
to return contiguous pages from highmem. virt_to_* functions
aren't valid on highmem pages, so store the struct page * in an
sg_table in buffer->priv_virt like most other heaps, and replace
virt_to_* with page_to_*.
Change-Id: Ida78888b101f080883716e1fa5038dfc4dbabd16
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Tue, 26 Nov 2013 23:33:33 +0000 (15:33 -0800)]
ion: allow cached mappings of chunk and system heap buffers
Now that ion_vm_fault uses vm_insert_pfn instead of vm_insert_page
cached buffers can be supported in any heap. Remove the checks
in the chunk and system heaps.
Change-Id: I371a44c400ed8a342c3b0eed90d0fb7060537697
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Tue, 26 Nov 2013 23:25:59 +0000 (15:25 -0800)]
ion: remove ion_heap_alloc_pages
Now that ion_vm_fault doesn't need a struct page with a nonzero
refcount, there is no need allocate heap memory for cached pages using
split_page. Remove the ion_heap_alloc_pages and ion_heap_free_pages
helpers in favor of direct calls to alloc_pages and __free_pages,
and remove the special handling in the system heap.
Change-Id: I5966a798f48df2d56642e662a69c1495944f6509
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Tue, 26 Nov 2013 23:05:46 +0000 (15:05 -0800)]
ion: use vm_insert_pfn for faulted pages
Most ion userspace mappings are created with remap_pfn_range. Use
vm_insert_pfn instead of vm_insert_page to make faulted cached
mappings look more like uncached mappings.
Change-Id: I9ec5cad3fef54f3b80be8b306d7ff2f1fe3f0e66
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Tue, 26 Nov 2013 23:34:50 +0000 (15:34 -0800)]
ion: check return value from remap_pfn_range
Check the return value of remap_pfn_range and return an error if
it fails.
Change-Id: I206cf95a24607ebe1c80274e3ed15cc7c076d007
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Fri, 22 Nov 2013 02:56:37 +0000 (18:56 -0800)]
ion: free low memory from page pools first
When the shrinkers are called with GFP_HIGH free low memory first,
it is more important to have free than high memory.
Change-Id: I7ad8a9c133830f04d429c3d87b781b3e862ccedb
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Mon, 25 Nov 2013 21:32:51 +0000 (13:32 -0800)]
ion: optimize ion_heap_buffer_zero
ion_heap_buffer_zero can spend a long time in unmap_kernel_range
if it has to broadcast a tlb flush to every cpu for every page.
Modify it to batch pages into a larger region to clear using a
single mapping. This may cause the mapping size to change if
the buffer size is not a multiple of the mapping size, so
switch to allocating the address space for each chunk. This
allows us to use vm_map_ram to handle the allocation and mapping
together.
The number of pages to zero using a single mapping is set to 32
to hit the fastpath in vm_map_ram.
Change-Id: I1accfe67b285cbc9e95e387bea4246864197827d
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Tue, 26 Nov 2013 21:43:29 +0000 (13:43 -0800)]
ion: add alignment check to carveout heap
Change-Id: I25c752b3eacb48cccea5be2df319634b3affd331
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Sat, 23 Nov 2013 06:48:42 +0000 (22:48 -0800)]
ion: drop dependency on ARM
Ion will compile and run on other platforms now, remove the
dependency on ARM.
Change-Id: I9da0ab686708bdab575a021031392b4402cce090
Signed-off-by: Colin Cross <ccross@android.com>
John Stultz [Fri, 22 Nov 2013 23:36:27 +0000 (15:36 -0800)]
ion: Fix two small issues in system_heap allocation
In testing ion system heap allocations, I ran across two issues:
1) Not k*z*allocing the sg table. This can cause trouble if
we end up trying call sg_alloc_table() with too many entries,
then sg_alloc_table() internally fails and tries to free what it
thinks is internal table structure, which causes bad pointer
traversals.
2) The second list_for_each_entry probably should be _safe,
since I was seeing strange lock warnings and oopses on occasion.
This seems to resolve it, but could use some extra checking.
Change-Id: I59d4c90104a8cf23dc4ae814d0b17348f1b68ac0
Signed-off-by: John Stultz <john.stultz@linaro.org>
Mitchel Humpherys [Tue, 6 Aug 2013 18:19:42 +0000 (11:19 -0700)]
gpu: ion: fix use-after-free in ion_heap_freelist_drain
The `buffer' variable is being used after being freed. Fix this.
Change-Id: Iea3471fa7dc7535bbf0620c1639fea2008d7cf19
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Colin Cross [Sat, 9 Nov 2013 00:55:35 +0000 (16:55 -0800)]
ion: clean up ioctls
Convert the ion ioctls to use _IOW instead of _IOWR where
appropriate, and factor out the copy_from_user and copy_to_user
based on the _IOC_DIR bits. For the existing incorrect ioctls,
add a function to wrap _IOC_DIR to return the corrected value.
Change-Id: I3cc34c84b9c52305bdbec27a9224447b102fadcd
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Thu, 7 Nov 2013 20:18:57 +0000 (12:18 -0800)]
gpu: ion: remove unnecessary function from system heap
ion_system_contig_heap buffers have an sglist, just call
ion_heap_map_user to map it.
Change-Id: I6dea383955834613fa8833659b31533c957c2b0b
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Thu, 19 Sep 2013 14:20:23 +0000 (09:20 -0500)]
ion: fix printk warnings
Use %z for size_t and %pa for dma_addr_t to avoid warnings in printks.
Change-Id: I2c72874acd0b69cb35fca691928783817deb9394
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Thu, 19 Sep 2013 15:13:53 +0000 (10:13 -0500)]
ion: don't use phys_to_page or __phys_to_pfn
phys_to_page and __phys_to_pfn don't exist on all platforms.
Use a combination of pfn_to_page, PFN_DOWN, page_to_pfn, and
virt_to_page to get the same results.
Change-Id: I53cef26059800bc8b7fb85ae458741574c97c257
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Thu, 19 Sep 2013 15:12:05 +0000 (10:12 -0500)]
ion: don't use __arm_ioremap to map pages
ion_heap_map_kernel already implements mapping a scatterlist of
pages into the kernel, and all heaps are required to have struct
pages associated with them, so delete the functions that use
__arm_ioremap and use ion_heap_map_kernel instead.
Change-Id: Ia2dfd8d8c6e719d7d2f68dd4c458826fdb938260
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Thu, 19 Sep 2013 19:54:56 +0000 (14:54 -0500)]
ion: update idr to avoid deprecated apis
Use idr_alloc instead if idr_pre_get/idr_get_new_above, and
remove idr_remove_all.
Change-Id: I675b789879549bd3767ed3ef2016cf108eb622d2
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Sat, 9 Nov 2013 00:32:47 +0000 (16:32 -0800)]
ion: add test device for unit tests to interact with dma_bufs
Add a /dev/ion-test device that will be created if CONFIG_ION_TEST
is set. The device accepts a dma_buf fd and allows reading and
writing to the backing memory using DMA-like apis or kernel mapping
apis. Can be used to test the dma_buf mapping ops, including
the ion implementations, from userspace.
Change-Id: I30703ba69cd75bdfe7767ac642e5f0cacd8d0478
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Wed, 13 Nov 2013 22:46:06 +0000 (14:46 -0800)]
ion: check invalid values in ion_system_heap
ion_system_heap can only satisfy page alignment, and
ion_system_contig_heap can only satisify alignment to the
allocation size. Neither can support faulting user mappings
because they use slab pages.
Change-Id: I895c2d4184c672f647f83a17aeb862985dc92f2c
Signed-off-by: Colin Cross <ccross@android.com>
Arve Hjønnevåg [Tue, 25 Jun 2013 01:02:05 +0000 (18:02 -0700)]
ARM: fiq_glue: Add custom fiq return handler api.
Change-Id: I5ff2764e85151ca0a88576542fda07c2d33dd065
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Greg Hackmann [Thu, 5 Dec 2013 01:39:27 +0000 (17:39 -0800)]
netfilter: xt_qtaguid: fix memory leak in seq_file handlers
Change-Id: I15b21230d52479d008a00d9e2191dda020f00925
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Greg Hackmann [Fri, 22 Nov 2013 21:50:24 +0000 (13:50 -0800)]
video: adf: fix fbdev blank -> dpms state mapping
Change-Id: I96132a1b7275d389a6d0ba8899c6be838b63c422
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Greg Hackmann [Wed, 20 Nov 2013 20:10:35 +0000 (12:10 -0800)]
video: adf: validate dpms state passed to blank
Change-Id: I3a4228d50fc4a2553b3e92e5675a94cbc6e71b8a
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Greg Hackmann [Mon, 11 Nov 2013 22:31:12 +0000 (14:31 -0800)]
video: adf: fix ADF_MAX_ATTACHMENTS declaration
Userspace-facing ADF_MAX_ATTACHMENTS must be in terms of
userspace-facing struct adf_attachment_config
Change-Id: Iaaddcd6366f13b3e52eb3911efcfff8a61e0b225
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Greg Hackmann [Wed, 20 Nov 2013 22:02:09 +0000 (14:02 -0800)]
video: adf: remove PAGE_SIZE from userspace-facing header
Systems may define PAGE_SIZE in userspace limits.h but don't have to.
PAGE_SIZE was picked as an arbitrary "reasonable" limit so just use 4096
instead.
Change-Id: I9555e39aba64a3a70f61eb6ded2a4129ab236ce0
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Greg Hackmann [Thu, 7 Nov 2013 18:12:00 +0000 (10:12 -0800)]
video: adf: make device node names less hierarchical
adf/foobar/device -> adf0
adf/foobar/interface1 -> adf-interface0.1
adf/foobar/overlay-engine1 -> adf-overlay-engine0.1
Change-Id: I7af7f84ce3f101ecb02f448070c200ff3e03f2ec
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Colin Cross [Tue, 12 Nov 2013 23:28:08 +0000 (15:28 -0800)]
ion: convert sg_dma_len(sg) to sg->length
ion is always dealing with the allocation and not the mapping,
so it should always be using sg->length and not sg->dma_length.
Change-Id: Id9b07f1196b2bafe04636fa1aa46dfc84d003cf0
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Wed, 18 Sep 2013 17:30:20 +0000 (12:30 -0500)]
ion: fix dma APIs
__dma_page_cpu_to_dev is a private ARM api that is not available
on 3.10 and was never available on other architectures. We can
get the same behavior by calling dma_sync_sg_for_device with a
scatterlist containing a single page. It's still not quite a
kosher use of the dma apis, we still conflate physical addresses
with bus addresses, but it should at least compile on all
platforms, and work on any platform that doesn't have a physical
to bus address translation.
Change-Id: I8451c2dae4bf85841015c016640684ac28430a5a
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Wed, 13 Nov 2013 22:44:53 +0000 (14:44 -0800)]
ion: fix crash when alloc len is -1
If userspace passes a length between -4095 and -1 to allocate it
will pass the len != 0 check, but when len is page aligned it will
be 0. Check len after page aligning.
Drop the warning as well, userspace shouldn't be able to trigger
a warning in the kernel.
Change-Id: I96c7142637638991f3a9af9be7cfbb50f79f3803
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Wed, 6 Nov 2013 00:51:27 +0000 (16:51 -0800)]
ion: hold reference to handle after ion_uhandle_get
commit
1262ab1846cf76f7549c66ef709120dbfbe6d49f (ion: replace
userspace handle cookies with idr) broke the locking in ion.
The ION_IOC_FREE and ION_IOC_MAP ioctls were relying on
ion_handle_validate to detect the case where a call raced
with another ION_IOC_FREE which may have freed the struct
ion_handle.
Rename ion_uhandle_get to ion_handle_get_by_id, and have it
take the client lock and return with an extra reference to
the handle. Make each caller put its reference once it
is done with the handle.
Also modify users of ion_handle_validate to continue to hold
the client lock after calling ion_handle_validate until
they are done with the handle, and warn if ion_handle_validate
is called without the client lock held.
Change-Id: I56da5624fca3bed4ee24806b6ec39de903543341
Signed-off-by: Colin Cross <ccross@android.com>
John Stultz [Fri, 15 Nov 2013 00:25:08 +0000 (16:25 -0800)]
ion: Fix compat support to use proper compat ioctl numbers
The compat support added to ion didn't provide compat ioctl numbers
(who's value depends on the compat structure size). So 32bit
applications would get an error when trying to make ioctl calls.
This patch adds the needed COMPAT_ macros and uses them in the
compat_ion_ioctl, translating them to their non-compat cmd when
calling the normal ioctl call.
Change-Id: I53636d4ec46d8dc5e694697aaf2d62b98bd78cb1
Signed-off-by: John Stultz <john.stultz@linaro.org>
Arve Hjønnevåg [Sat, 15 Jun 2013 02:54:40 +0000 (19:54 -0700)]
ARM: Fix "Make low-level printk work" to use a separate config option
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Benoit Goby [Fri, 8 Nov 2013 23:24:19 +0000 (15:24 -0800)]
ARM: Fix dtb list when DTB_IMAGE_NAMES is empty
In the 3.10 kernel, dtb-y is not defined in Makefile.boot anymore
but in dts/Makefile, so it needs to be included too.
Change-Id: I6d6fccf933709bcb6220ce8f12b4b9e2a7c40d63
Signed-off-by: Benoit Goby <benoit@android.com>
Colin Cross [Wed, 30 Oct 2013 20:17:34 +0000 (13:17 -0700)]
anonymous vma names: fix build with !MMU
Disable PR_SET_VMA when building with !MMU
Change-Id: I896b6979b99aa61df85caf4c3ec22eb8a8204e64
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Wed, 30 Oct 2013 20:14:12 +0000 (13:14 -0700)]
mm: fix anon vma naming
Fix two bugs caused by merging anon vma_naming, a typo in
mempolicy.c and a bad merge in sys.c.
Change-Id: Ia4ced447d50573e68195e95ea2f2b4d9456b8a90
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Thu, 7 Nov 2013 21:46:41 +0000 (13:46 -0800)]
drivers: staging: android: split uapi out of sync.h and sw_sync.h
Move the userspace interfaces of sync.h and sw_sync.h to
drivers/staging/android/uapi/
Change-Id: I3b2598b37385bb993bd03f5faa98a8e196befe45
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Thu, 7 Nov 2013 21:46:41 +0000 (13:46 -0800)]
drivers: staging: android: split uapi out of binder.h
Move the userspace interface of binder.h to
drivers/staging/android/uapi/binder.h.
Change-Id: I2e56ba89ade5e1f33b121e6ecd456392d588a14e
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Thu, 7 Nov 2013 21:46:41 +0000 (13:46 -0800)]
drivers: staging: android: split uapi out of ashmem.h
Move the userspace interface of ashmem.h to
drivers/staging/android/uapi/ashmem.h
Change-Id: I60f5baa4ce8e2425262a406f2733c089ec55aa72
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Thu, 7 Nov 2013 21:38:57 +0000 (13:38 -0800)]
drivers: staging: android: split uapi out of android_alarm.h
Move the userspace interface of android_alarm.h to
drivers/staging/android/uapi/android_alarm.h
Change-Id: Ieb96e8e9bf742786efc4e248e6a242dab8199ca3
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Thu, 7 Nov 2013 21:19:34 +0000 (13:19 -0800)]
net: move PPPoLAC and PPPoPNS headers to uapi
Move the entire contents of the linux/if_pppolac.h and
linux/if_pppopns.h headers to uapi, they only contain userspace
interfaces.
Change-Id: I3cfed7f2ae400b53269a1f59144aa3dbc30ae0b5
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Thu, 7 Nov 2013 21:08:39 +0000 (13:08 -0800)]
usb: gadget: f_accessory: move userspace interface to uapi
Move the entire contents of linux/usb/f_accessory.h header to uapi,
it only contains a userspace interface.
Change-Id: Ieb5547da449588ae554988a201c0e6b4e3afc531
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Thu, 7 Nov 2013 21:08:15 +0000 (13:08 -0800)]
usb: gadget: f_mtp: move userspace interface to uapi
Move the most of linux/usb/f_mtp.h header to uapi. Move the only
remaining structure definition into f_mtp.c, the only place that
uses it.
Change-Id: I952c1a9dc15c36bf295a0eb4d74b6b1ad912ed03
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Thu, 7 Nov 2013 20:46:33 +0000 (12:46 -0800)]
input: misc: keychord: move header to uapi
Move the entire contents of linux/keychord.h header to uapi, it only
contains a userspace interface.
Change-Id: If94f83328b19efb58c66391dce3bd8e927788d8d
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Thu, 7 Nov 2013 21:29:12 +0000 (13:29 -0800)]
ion: move userspace api into uapi/ion.h
Split the userspace api out of drivers/staging/android/ion/ion.h
into drivers/staging/android/uapi/ion.h
Change-Id: I51baa4a7c86bf99c493e28a15f8664a489fd5a2d
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Thu, 7 Nov 2013 20:25:56 +0000 (12:25 -0800)]
ion: move into staging
Move ion from drivers/gpu/ion to drivers/android/staging/ion.
Change-Id: Id6e996aa3954cbb8e1a8abc9578a56204f5eb211
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Fri, 30 Aug 2013 00:50:42 +0000 (17:50 -0700)]
gpu: ion: delete ion_system_mapper.c
The mapper abstraction layer was removed before the initial ion
commit, but a stray ion_system_mapper.c file was left in. Delete
it.
Change-Id: I0001d1ea1b866ebd7ec1306e94472c67a094855f
Signed-off-by: Colin Cross <ccross@android.com>
Qiao Zhou [Thu, 31 Oct 2013 01:36:50 +0000 (09:36 +0800)]
drivers: switch: remove S_IWUSR from dev_attr
it doesn't need S_IWUSR attribute since xxx_store API is un-needed.
otherwise the WARN check in device_create_file will alert.
Change-Id: I6360bf022dcd659bfb3f41c84624f954d5d15ea5
Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Greg Hackmann [Tue, 29 Oct 2013 19:43:07 +0000 (12:43 -0700)]
Merge branch 'android-3.10-adf' into android-3.10
Rom Lemarchand [Thu, 24 Oct 2013 12:39:34 +0000 (05:39 -0700)]
ion: add compat_ioctl
Add a compat_ioctl to the ion driver
Change-Id: I43da387e22ff9c4a29f0159dfe9e898efc500553
Signed-off-by: Rom Lemarchand <romlem@google.com>
Rom Lemarchand [Thu, 24 Oct 2013 02:30:58 +0000 (19:30 -0700)]
ion: change ion_user_handle_t definition to int
Turn ion_user_handle_t to int. This change reflects the underlying type
returned by the ion driver.
Change-Id: I40390dae8138327769510525bf62e55877a4b37d
Signed-off-by: Rom Lemarchand <romlem@google.com>
Benoit Goby [Sat, 19 Oct 2013 00:16:38 +0000 (17:16 -0700)]
usb: gadget: android: Remove device if probe fails
Make sure the android0 device is removed before we can destroy
the class.
Change-Id: Id584888c407beb80a1df4990f73fe31ccb9d4767
Signed-off-by: Benoit Goby <benoit@android.com>
Greg Hackmann [Thu, 17 Oct 2013 20:18:53 +0000 (13:18 -0700)]
video: adf: expose adf_modeinfo_set_{name,vrefresh} to drivers
Change-Id: Id9f8b2184927a77b244ce0b33d619d6e44a0f17a
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Greg Hackmann [Wed, 16 Oct 2013 21:53:12 +0000 (14:53 -0700)]
video: adf: set default interface dpms_state to OFF
Interfaces default to unplugged, so they should also default to off
Change-Id: I36500a54b11f354a0d7dd2c9924a79e0d9c6f855
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Greg Hackmann [Thu, 15 Aug 2013 19:51:22 +0000 (12:51 -0700)]
video: adf: make dpms_state sysfs attribute writable
Change-Id: I04e7785cbddac160003e6c9edaf62d20b367fdc9
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Greg Hackmann [Tue, 15 Oct 2013 19:51:20 +0000 (12:51 -0700)]
video: adf: add helpers for validating custom formats
Many custom formats look a lot like the standard ones, but with
different subsampling, bpp, etc. Expose and document
adf_buffer_validate()'s main body, so drivers can reuse its logic when
validating these formats.
Change-Id: I1d06981c9e5aab26f3ab2956c08c679f2c823bcc
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Alistair Strachan [Wed, 10 Apr 2013 23:35:14 +0000 (16:35 -0700)]
sync: Fix a race condition between release_obj and print_obj
Before this change, a timeline would only be removed from the timeline
list *after* the sync driver had its release_obj() called. However, the
driver's release_obj() may free resources needed by print_obj().
Although the timeline list is locked when print_obj() is called, it is
not locked when release_obj() is called. If one CPU was in print_obj()
when another was in release_obj(), the print_obj() may make unsafe
accesses.
It is not actually necessary to hold the timeline list lock when calling
release_obj() if the call is made after the timeline is unlinked from
the list, since there is no possibility another thread could be in --
or enter -- print_obj() for that timeline.
This change moves the release_obj() call to after the timeline is
unlinked, preventing the above race from occurring.
Signed-off-by: Alistair Strachan <alistair.strachan@imgtec.com>
(cherry picked from commit
3bfc1e9e0c7d0c0e3f52ee1f3803482416afa295)
Change-Id: Ib2b2b23fde5be34016f9d86b8b9c5e561b56cd4c
Rom Lemarchand [Wed, 23 Oct 2013 22:09:11 +0000 (15:09 -0700)]
ion: add new ion_user_handle_t type for the user-space token
Declare new ion_user_handle_t type to contain the token returned to user-space.
This allows a 2-step migration of the user-space code to a new kernel header
first, then will allow us to change the definition of the ion_user_handle_type_t
to int without breaking the API.
Change-Id: I4200b6600df8e56fe98cf1580a13a65cb25ec646
Signed-off-by: Rom Lemarchand <romlem@google.com>
(cherry picked from commit
ebb8269bbb05b06ecedca3e21b3e65f23d48eadd)
Shridhar Rasal [Mon, 9 Sep 2013 13:47:14 +0000 (19:17 +0530)]
cpufreq: interactive: delete timers for GOV_START
Make sure that timers cpu_timer and cpu_slack_timer
deactivated before addition of new.
Change-Id: If31c4049606871df6f00efdc24b1d713c86a6f69
Signed-off-by: Shridhar Rasal <srasal@nvidia.com>
Signed-off-by: Bharat Nihalani <bnihalani@nvidia.com>
Viresh Kumar [Thu, 16 May 2013 09:28:54 +0000 (14:58 +0530)]
cpufreq: Interactive: Implement per policy instances of governor
If we have a multi-package system, where we have multiple instances of struct
policy (per package), currently we can't have multiple instances of same
governor. i.e. We can't have multiple instances of Interactive governor for
multiple packages.
This is a bottleneck for multicluster system, where we want different packages
to use Interactive governor, but with different tunables.
This patch uses the infrastructure provided by earlier patches pushed in
Mainline in v3.10-rc1/rc2 and implements per policy instances of Interactive
governor.
Change-Id: I70436d4a5a45c6cb6edf37f3e46d0b9fbc930982
[toddpoynor@google.com: merge with later code, minor changes]
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Viresh Kumar [Thu, 16 May 2013 09:28:53 +0000 (14:58 +0530)]
cpufreq: interactive: Move definition of cpufreq_gov_interactive downwards
This moves definition of cpufreq_gov_interactive towards the bottom of file, so
that we don't have to add prototype of cpufreq_governor_interactive() in the
beginning of file.
Change-Id: I04bd1004954eb36502c5cd7e35d3d7274cddaf95
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Viresh Kumar [Thu, 16 May 2013 09:28:52 +0000 (14:58 +0530)]
cpufreq: interactive: Remove unnecessary cpu_online() check
Cpufreq no longer calls governor callback for offlined cpus. i.e. All
policy->cpus are guaranteed to be online. Hence we don't need explicit check to
see if cpu is online or not.
Change-Id: I9ad85ea4addd5b4a40952e59ed730dd15e328690
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Prakash Kamliya [Fri, 4 Oct 2013 12:20:50 +0000 (17:50 +0530)]
sync: signal pt before sync_timeline object gets destroyed
There is a race condition
Assume we have *one* sync_fence object, with *one* sync_pt
which belongs to *one* sync_timeline, given this condition,
sync_timeline->kref will have two counts, one for sync_timeline
(implicit) and another for sync_pt.
Assume following is the situation on CPU
Theead-1 : (Thread which calls sync_timeline_destroy())
-> (some function calls)
-> sync_timeline_destory()
-> sync_timeline_signal() (CPU is inside this
function after putting reference to sync_timeline)
At this time Thread-2 comes and does following
Thread-2 : (fclose on fence fd)
> sync_fence_release() -> because of fclose() on fence object
-> sync_fence_free()
-> sync_pt_free()
-> kref_put(&pt->parent->kref, sync_timeline_free);
-> sync_timeline_free() (CPU is inside this because
this time kref will be zero after _put)
Thread-2 will free sync_timeline object before Thread-1
has finished its work inside sync_timeline_signal.
With this change we signals all sync_pt before putting
reference to sync_timeline object.
Change-Id: Ic680e4d0bbef1c46bcb7cfba693395645241d203
Signed-off-by: Prakash Kamliya <pkamliya@codeaurora.org>
Greg Hackmann [Fri, 13 Sep 2013 18:23:05 +0000 (11:23 -0700)]
video: adf: add informational flags to interfaces
Informational flags don't affect ADF directly but may be useful to
clients. Currently used to indicate primary and external displays.
Change-Id: I343c7f0148da0869244c8e818350e9855525df85
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Greg Hackmann [Tue, 9 Jul 2013 20:07:26 +0000 (13:07 -0700)]
video: adf: add fbdev compatibility helper
Change-Id: I2b82bb625f805e8edb27799743b290dda5befb97
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Greg Hackmann [Tue, 11 Jun 2013 19:59:41 +0000 (12:59 -0700)]
video: adf: add supported formats to adf_overlay_engine_data
Change-Id: If2aa783b9ece60160f465bf697508fc58682e1bc
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Greg Hackmann [Thu, 10 Oct 2013 20:03:26 +0000 (13:03 -0700)]
video: adf: support "simple" buffers
Simple buffers are linear RGB buffers analogous to KMS's dumb buffers.
Simple buffers can be allocated and posted to a display interface
without any driver-private data.
Internally, ADF drivers provide the driver-private data needed (if any)
to post a simple buffer to the display.
Change-Id: Ib0b737622eaf343111310f6623f99d69cf3807d2
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Greg Hackmann [Mon, 8 Jul 2013 21:18:18 +0000 (14:18 -0700)]
video: adf: add memblock helper
Provides a dma-buf exporter for memblocks, mainly useful for ADF devices
to wrap their bootloader logos
Change-Id: I936a9b5df099ab6084d433fcaf50f3bc29f93289
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Greg Hackmann [Wed, 22 May 2013 21:23:10 +0000 (14:23 -0700)]
video: add atomic display framework
Change-Id: I693257e269a99012cd0dbb57576ac222869cf4c7
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Greg Hackmann [Fri, 11 Oct 2013 20:54:41 +0000 (13:54 -0700)]
staging: sw_sync: add stubs for kernels without CONFIG_SW_SYNC
Change-Id: I7a12679eb3c10b1beaf36c6612cf2e3f6662a034
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Minchan Kim [Wed, 3 Jul 2013 22:01:24 +0000 (15:01 -0700)]
mm: remove compressed copy from zram in-memory
Swap subsystem does lazy swap slot free with expecting the page would be
swapped out again so we can avoid unnecessary write.
But the problem in in-memory swap(ex, zram) is that it consumes memory
space until vm_swap_full(ie, used half of all of swap device) condition
meet. It could be bad if we use multiple swap device, small in-memory
swap and big storage swap or in-memory swap alone.
This patch makes swap subsystem free swap slot as soon as swap-read is
completed and make the swapcache page dirty so the page should be
written out the swap device to reclaim it. It means we never lose it.
I tested this patch with kernel compile workload.
1. before
compile time : 9882.42
zram max wasted space by fragmentation:
13471881 byte
memory space consumed by zram:
174227456 byte
the number of slot free notify: 206684
2. after
compile time : 9653.90
zram max wasted space by fragmentation:
11805932 byte
memory space consumed by zram:
154001408 byte
the number of slot free notify: 426972
[akpm@linux-foundation.org: tweak comment text]
[artem.savkov@gmail.com: fix BUG due to non-swapcache pages in end_swap_bio_read()]
[akpm@linux-foundation.org: invert unlikely() test, augment comment, 80-col cleanup]
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Artem Savkov <artem.savkov@gmail.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Seth Jennings <sjenning@linux.vnet.ibm.com>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Konrad Rzeszutek Wilk <konrad@darnok.org>
Cc: Shaohua Li <shli@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Bintian Wang [Sun, 30 Jun 2013 12:34:24 +0000 (20:34 +0800)]
Add compat_ioctl support for VFAT_IOCTL_GET_VOLUME_ID
Add VFAT_IOCTL_GET_VOLUME_ID to vfat dir compat_ioctl() interface,
which enable you read vfat volume ID from a 32bit app on a 64bit
kernel
Change-Id: I3e93dfcc1e7a364a6b11bc7e3f5f210e82f306ed
Signed-off-by: Bintian Wang <bintian.wang@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>