]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/vmalloc: move free_vm_area(area) from the __vmalloc_area_node function to the...
authorLiu Ye <liuye@kylinos.cn>
Mon, 3 Mar 2025 01:57:02 +0000 (09:57 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 4 Mar 2025 05:50:50 +0000 (21:50 -0800)
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.

Link: https://lkml.kernel.org/r/20250303015702.319416-1-liuye@kylinos.cn
Signed-off-by: Liu Ye <liuye@kylinos.cn>
Cc: Christop Hellwig <hch@infradead.org>
Cc: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/vmalloc.c

index 61981ee1c9d2f769d4a06ab542fc84334c1b0cbd..76c101a55d8103d6bda3e946816915515bf197c6 100644 (file)
@@ -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 @@ again:
 
        /* 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.