Thread (24 messages) 24 messages, 8 authors, 2016-11-08

Re: [PATCH 4/6] mm: remove free_unmap_vmap_area_addr

From: Joel Fernandes <hidden>
Date: 2016-10-21 00:46:41
Also in: linux-mm, lkml

Hi Christoph,

On Mon, Oct 17, 2016 at 11:56 PM, Christoph Hellwig [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Just inline it into the only caller.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 mm/vmalloc.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 8cedfa0..2af2921 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -717,16 +717,6 @@ static struct vmap_area *find_vmap_area(unsigned long addr)
        return va;
 }

-static void free_unmap_vmap_area_addr(unsigned long addr)
-{
-       struct vmap_area *va;
-
-       va = find_vmap_area(addr);
-       BUG_ON(!va);
-       free_unmap_vmap_area(va);
-}
-
-
 /*** Per cpu kva allocator ***/

 /*
@@ -1090,6 +1080,7 @@ void vm_unmap_ram(const void *mem, unsigned int count)
 {
        unsigned long size = (unsigned long)count << PAGE_SHIFT;
        unsigned long addr = (unsigned long)mem;
+       struct vmap_area *va;

        might_sleep();
        BUG_ON(!addr);
@@ -1100,10 +1091,14 @@ void vm_unmap_ram(const void *mem, unsigned int count)
        debug_check_no_locks_freed(mem, size);
        vmap_debug_free_range(addr, addr+size);

-       if (likely(count <= VMAP_MAX_ALLOC))
+       if (likely(count <= VMAP_MAX_ALLOC)) {
                vb_free(mem, size);
-       else
-               free_unmap_vmap_area_addr(addr);
+               return;
+       }
+
+       va = find_vmap_area(addr);
+       BUG_ON(!va);
Considering recent objections to BUG_ON [1], lets make this a WARN_ON
while we're moving the code?
+       free_unmap_vmap_area(va);
 }
 EXPORT_SYMBOL(vm_unmap_ram);

--
2.1.4
Thanks,

Joel

[1] https://lkml.org/lkml/2016/10/6/65
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help