aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmalloc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-07-30 13:11:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-30 13:11:31 -0400
commit6f51f51582e793ea13e7de7ed6b138f71c51784b (patch)
tree211ecbf88cdf2f183e23da3f8f23153ac6133410 /mm/vmalloc.c
parent76159c20c0bcf5b38178fbfb61049eeb6380bb54 (diff)
parent97ef952a20853fad72087a53fa556fbec45edd8f (diff)
Merge branch 'for-linus-for-3.6-rc1' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping
Pull DMA-mapping updates from Marek Szyprowski: "Those patches are continuation of my earlier work. They contains extensions to DMA-mapping framework to remove limitation of the current ARM implementation (like limited total size of DMA coherent/write combine buffers), improve performance of buffer sharing between devices (attributes to skip cpu cache operations or creation of additional kernel mapping for some specific use cases) as well as some unification of the common code for dma_mmap_attrs() and dma_mmap_coherent() functions. All extensions have been implemented and tested for ARM architecture." * 'for-linus-for-3.6-rc1' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping: ARM: dma-mapping: add support for DMA_ATTR_SKIP_CPU_SYNC attribute common: DMA-mapping: add DMA_ATTR_SKIP_CPU_SYNC attribute ARM: dma-mapping: add support for dma_get_sgtable() common: dma-mapping: introduce dma_get_sgtable() function ARM: dma-mapping: add support for DMA_ATTR_NO_KERNEL_MAPPING attribute common: DMA-mapping: add DMA_ATTR_NO_KERNEL_MAPPING attribute common: dma-mapping: add support for generic dma_mmap_* calls ARM: dma-mapping: fix error path for memory allocation failure ARM: dma-mapping: add more sanity checks in arm_dma_mmap() ARM: dma-mapping: remove custom consistent dma region mm: vmalloc: use const void * for caller argument scatterlist: add sg_alloc_table_from_pages function
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r--mm/vmalloc.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index c7ac8e1b3ac7..e03f4c7307a5 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1280,7 +1280,7 @@ DEFINE_RWLOCK(vmlist_lock);
1280struct vm_struct *vmlist; 1280struct vm_struct *vmlist;
1281 1281
1282static void setup_vmalloc_vm(struct vm_struct *vm, struct vmap_area *va, 1282static void setup_vmalloc_vm(struct vm_struct *vm, struct vmap_area *va,
1283 unsigned long flags, void *caller) 1283 unsigned long flags, const void *caller)
1284{ 1284{
1285 vm->flags = flags; 1285 vm->flags = flags;
1286 vm->addr = (void *)va->va_start; 1286 vm->addr = (void *)va->va_start;
@@ -1306,7 +1306,7 @@ static void insert_vmalloc_vmlist(struct vm_struct *vm)
1306} 1306}
1307 1307
1308static void insert_vmalloc_vm(struct vm_struct *vm, struct vmap_area *va, 1308static void insert_vmalloc_vm(struct vm_struct *vm, struct vmap_area *va,
1309 unsigned long flags, void *caller) 1309 unsigned long flags, const void *caller)
1310{ 1310{
1311 setup_vmalloc_vm(vm, va, flags, caller); 1311 setup_vmalloc_vm(vm, va, flags, caller);
1312 insert_vmalloc_vmlist(vm); 1312 insert_vmalloc_vmlist(vm);
@@ -1314,7 +1314,7 @@ static void insert_vmalloc_vm(struct vm_struct *vm, struct vmap_area *va,
1314 1314
1315static struct vm_struct *__get_vm_area_node(unsigned long size, 1315static struct vm_struct *__get_vm_area_node(unsigned long size,
1316 unsigned long align, unsigned long flags, unsigned long start, 1316 unsigned long align, unsigned long flags, unsigned long start,
1317 unsigned long end, int node, gfp_t gfp_mask, void *caller) 1317 unsigned long end, int node, gfp_t gfp_mask, const void *caller)
1318{ 1318{
1319 struct vmap_area *va; 1319 struct vmap_area *va;
1320 struct vm_struct *area; 1320 struct vm_struct *area;
@@ -1375,7 +1375,7 @@ EXPORT_SYMBOL_GPL(__get_vm_area);
1375 1375
1376struct vm_struct *__get_vm_area_caller(unsigned long size, unsigned long flags, 1376struct vm_struct *__get_vm_area_caller(unsigned long size, unsigned long flags,
1377 unsigned long start, unsigned long end, 1377 unsigned long start, unsigned long end,
1378 void *caller) 1378 const void *caller)
1379{ 1379{
1380 return __get_vm_area_node(size, 1, flags, start, end, -1, GFP_KERNEL, 1380 return __get_vm_area_node(size, 1, flags, start, end, -1, GFP_KERNEL,
1381 caller); 1381 caller);
@@ -1397,13 +1397,21 @@ struct vm_struct *get_vm_area(unsigned long size, unsigned long flags)
1397} 1397}
1398 1398
1399struct vm_struct *get_vm_area_caller(unsigned long size, unsigned long flags, 1399struct vm_struct *get_vm_area_caller(unsigned long size, unsigned long flags,
1400 void *caller) 1400 const void *caller)
1401{ 1401{
1402 return __get_vm_area_node(size, 1, flags, VMALLOC_START, VMALLOC_END, 1402 return __get_vm_area_node(size, 1, flags, VMALLOC_START, VMALLOC_END,
1403 -1, GFP_KERNEL, caller); 1403 -1, GFP_KERNEL, caller);
1404} 1404}
1405 1405
1406static struct vm_struct *find_vm_area(const void *addr) 1406/**
1407 * find_vm_area - find a continuous kernel virtual area
1408 * @addr: base address
1409 *
1410 * Search for the kernel VM area starting at @addr, and return it.
1411 * It is up to the caller to do all required locking to keep the returned
1412 * pointer valid.
1413 */
1414struct vm_struct *find_vm_area(const void *addr)
1407{ 1415{
1408 struct vmap_area *va; 1416 struct vmap_area *va;
1409 1417
@@ -1568,9 +1576,9 @@ EXPORT_SYMBOL(vmap);
1568 1576
1569static void *__vmalloc_node(unsigned long size, unsigned long align, 1577static void *__vmalloc_node(unsigned long size, unsigned long align,
1570 gfp_t gfp_mask, pgprot_t prot, 1578 gfp_t gfp_mask, pgprot_t prot,
1571 int node, void *caller); 1579 int node, const void *caller);
1572static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, 1580static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
1573 pgprot_t prot, int node, void *caller) 1581 pgprot_t prot, int node, const void *caller)
1574{ 1582{
1575 const int order = 0; 1583 const int order = 0;
1576 struct page **pages; 1584 struct page **pages;
@@ -1643,7 +1651,7 @@ fail:
1643 */ 1651 */
1644void *__vmalloc_node_range(unsigned long size, unsigned long align, 1652void *__vmalloc_node_range(unsigned long size, unsigned long align,
1645 unsigned long start, unsigned long end, gfp_t gfp_mask, 1653 unsigned long start, unsigned long end, gfp_t gfp_mask,
1646 pgprot_t prot, int node, void *caller) 1654 pgprot_t prot, int node, const void *caller)
1647{ 1655{
1648 struct vm_struct *area; 1656 struct vm_struct *area;
1649 void *addr; 1657 void *addr;
@@ -1699,7 +1707,7 @@ fail:
1699 */ 1707 */
1700static void *__vmalloc_node(unsigned long size, unsigned long align, 1708static void *__vmalloc_node(unsigned long size, unsigned long align,
1701 gfp_t gfp_mask, pgprot_t prot, 1709 gfp_t gfp_mask, pgprot_t prot,
1702 int node, void *caller) 1710 int node, const void *caller)
1703{ 1711{
1704 return __vmalloc_node_range(size, align, VMALLOC_START, VMALLOC_END, 1712 return __vmalloc_node_range(size, align, VMALLOC_START, VMALLOC_END,
1705 gfp_mask, prot, node, caller); 1713 gfp_mask, prot, node, caller);