linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/vmalloc: Move free_vm_area(area) from the __vmalloc_area_node function to the __vmalloc_node_range_noprof function
@ 2025-03-03  1:57 Liu Ye
  2025-03-04  0:47 ` Andrew Morton
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Liu Ye @ 2025-03-03  1:57 UTC (permalink / raw)
  To: akpm; +Cc: urezki, hch, linux-mm, linux-kernel, Liu Ye

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.

Signed-off-by: Liu Ye <liuye@kylinos.cn>
---
 mm/vmalloc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index a6e7acebe9ad..dc658d4af181 100644
--- 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.
-- 
2.25.1



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-03-14  1:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-03  1:57 [PATCH] mm/vmalloc: Move free_vm_area(area) from the __vmalloc_area_node function to the __vmalloc_node_range_noprof function Liu Ye
2025-03-04  0:47 ` Andrew Morton
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox