aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r--mm/vmalloc.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index fb42a5bffe47..ae7d20b447ff 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -469,8 +469,8 @@ overflow:
469 goto retry; 469 goto retry;
470 } 470 }
471 if (printk_ratelimit()) 471 if (printk_ratelimit())
472 pr_warn("vmap allocation for size %lu failed: " 472 pr_warn("vmap allocation for size %lu failed: use vmalloc=<size> to increase size\n",
473 "use vmalloc=<size> to increase size.\n", size); 473 size);
474 kfree(va); 474 kfree(va);
475 return ERR_PTR(-EBUSY); 475 return ERR_PTR(-EBUSY);
476} 476}
@@ -531,22 +531,21 @@ static void unmap_vmap_area(struct vmap_area *va)
531static void vmap_debug_free_range(unsigned long start, unsigned long end) 531static void vmap_debug_free_range(unsigned long start, unsigned long end)
532{ 532{
533 /* 533 /*
534 * Unmap page tables and force a TLB flush immediately if 534 * Unmap page tables and force a TLB flush immediately if pagealloc
535 * CONFIG_DEBUG_PAGEALLOC is set. This catches use after free 535 * debugging is enabled. This catches use after free bugs similarly to
536 * bugs similarly to those in linear kernel virtual address 536 * those in linear kernel virtual address space after a page has been
537 * space after a page has been freed. 537 * freed.
538 * 538 *
539 * All the lazy freeing logic is still retained, in order to 539 * All the lazy freeing logic is still retained, in order to minimise
540 * minimise intrusiveness of this debugging feature. 540 * intrusiveness of this debugging feature.
541 * 541 *
542 * This is going to be *slow* (linear kernel virtual address 542 * This is going to be *slow* (linear kernel virtual address debugging
543 * debugging doesn't do a broadcast TLB flush so it is a lot 543 * doesn't do a broadcast TLB flush so it is a lot faster).
544 * faster).
545 */ 544 */
546#ifdef CONFIG_DEBUG_PAGEALLOC 545 if (debug_pagealloc_enabled()) {
547 vunmap_page_range(start, end); 546 vunmap_page_range(start, end);
548 flush_tlb_kernel_range(start, end); 547 flush_tlb_kernel_range(start, end);
549#endif 548 }
550} 549}
551 550
552/* 551/*
@@ -1086,7 +1085,7 @@ void vm_unmap_ram(const void *mem, unsigned int count)
1086 BUG_ON(!addr); 1085 BUG_ON(!addr);
1087 BUG_ON(addr < VMALLOC_START); 1086 BUG_ON(addr < VMALLOC_START);
1088 BUG_ON(addr > VMALLOC_END); 1087 BUG_ON(addr > VMALLOC_END);
1089 BUG_ON(!IS_ALIGNED(addr, PAGE_SIZE)); 1088 BUG_ON(!PAGE_ALIGNED(addr));
1090 1089
1091 debug_check_no_locks_freed(mem, size); 1090 debug_check_no_locks_freed(mem, size);
1092 vmap_debug_free_range(addr, addr+size); 1091 vmap_debug_free_range(addr, addr+size);