Re: [PATCH 02/10] mm: remove __vfree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 19, 2023 at 11:02:18AM +0100, Christoph Hellwig wrote:
> __vfree is a subset of vfree that just skips a few checks, and which is
> only used by vfree and an error cleanup path.  Fold __vfree into vfree
> and switch the only other caller to call vfree() instead.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> ---
>  mm/vmalloc.c | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
> 
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 6957d15d526e46..b989828b45109a 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -2801,14 +2801,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
> @@ -2836,8 +2828,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);
>  
> @@ -3104,7 +3098,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
>  
>  	/*
>  	 * If not enough pages were obtained to accomplish an
> -	 * allocation request, free them via __vfree() if any.
> +	 * allocation request, free them via vfree() if any.
>  	 */
>  	if (area->nr_pages != nr_small_pages) {
>  		warn_alloc(gfp_mask, NULL,
> @@ -3144,7 +3138,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
>  	return area->addr;
>  
>  fail:
> -	__vfree(area->addr);
> +	vfree(area->addr);
>  	return NULL;
>  }
>  
> -- 
> 2.39.0
> 
Makes sense to me.

Reviewed-by: Uladzislau Rezki (Sony) <urezki@xxxxxxxxx>

--
Uladzislau Rezki




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux