linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Liu Ye <liuye@kylinos.cn>
Cc: urezki@gmail.com, hch@infradead.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/vmalloc: Move free_vm_area(area) from the __vmalloc_area_node function to the __vmalloc_node_range_noprof function
Date: Mon, 3 Mar 2025 16:47:16 -0800	[thread overview]
Message-ID: <20250303164716.a98b1e3ceb27a264b57a56d7@linux-foundation.org> (raw)
In-Reply-To: <20250303015702.319416-1-liuye@kylinos.cn>

On Mon,  3 Mar 2025 09:57:02 +0800 Liu Ye <liuye@kylinos.cn> wrote:

> Moved free_vm_area from the __vmalloc_area_node function to the
> __vmalloc_node_range_noprof function so that allocation and freeing
> of the area can be paired in one function for better readability.
> 
> ...
>
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -3651,7 +3651,6 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
>  		warn_alloc(gfp_mask, NULL,
>  			"vmalloc error: size %lu, failed to allocated page array size %lu",
>  			nr_small_pages * PAGE_SIZE, array_size);
> -		free_vm_area(area);
>  		return NULL;
>  	}
>  
> @@ -3844,8 +3843,10 @@ void *__vmalloc_node_range_noprof(unsigned long size, unsigned long align,
>  
>  	/* Allocate physical pages and map them into vmalloc space. */
>  	ret = __vmalloc_area_node(area, gfp_mask, prot, shift, node);
> -	if (!ret)
> +	if (!ret) {
> +		free_vm_area(area);
>  		goto fail;
> +	}
>  
>  	/*
>  	 * Mark the pages as accessible, now that they are mapped.

yes, nicer to free it at the level where it was allocated.


  reply	other threads:[~2025-03-04  0:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-03  1:57 Liu Ye
2025-03-04  0:47 ` Andrew Morton [this message]
2025-03-04  9:46 ` Uladzislau Rezki
2025-03-13  8:49 ` Lai, Yi
2025-03-13  9:18 ` Lai, Yi
2025-03-13 10:26   ` Dev Jain
2025-03-13 10:30     ` Uladzislau Rezki
     [not found] ` <1741913782357008.47.seg@mailgw.kylinos.cn>
2025-03-14  1:00   ` liuye
     [not found] ` <1741913791967613.48.seg@mailgw.kylinos.cn>
2025-03-14  1:03   ` liuye

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250303164716.a98b1e3ceb27a264b57a56d7@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liuye@kylinos.cn \
    --cc=urezki@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox