[PATCH 02/12] mm: remove __vfree

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Thu Sep 24 07:30:34 UTC 2020


From: Christoph Hellwig <hch at lst.de>

vmalloc-style allocations from interrupt context trigger a BUG_ON in
__get_vm_area_node, so there is no point in trying to handle freeing
a partial allocation in interrupt context.  With that gone only a
single caller of __vfree is left, and it can be open coded there.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 mm/vmalloc.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 8770260419af..e1ae369a5d9f 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2312,14 +2312,6 @@ void vfree_atomic(const void *addr)
 	__vfree_deferred(addr);
 }
 
-static void __vfree(const void *addr)
-{
-	if (unlikely(in_interrupt()))
-		__vfree_deferred(addr);
-	else
-		__vunmap(addr, 1);
-}
-
 /**
  * vfree - Release memory allocated by vmalloc()
  * @addr:  Memory base address
@@ -2348,7 +2340,10 @@ void vfree(const void *addr)
 	if (!addr)
 		return;
 
-	__vfree(addr);
+	if (unlikely(in_interrupt()))
+		__vfree_deferred(addr);
+	else
+		__vunmap(addr, 1);
 }
 EXPORT_SYMBOL(vfree);
 
@@ -2469,7 +2464,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
 	warn_alloc(gfp_mask, NULL,
 			  "vmalloc: allocation failure, allocated %ld of %ld bytes",
 			  (area->nr_pages*PAGE_SIZE), area->size);
-	__vfree(area->addr);
+	__vunmap(area->addr, 1);
 	return NULL;
 }
 
-- 
2.25.1



More information about the Intel-gfx-trybot mailing list