[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250303094410.437985-4-liuye@kylinos.cn>
Date: Mon, 3 Mar 2025 17:44:09 +0800
From: Liu Ye <liuye@...inos.cn>
To: akpm@...ux-foundation.org
Cc: urezki@...il.com,
hch@...radead.org,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Liu Ye <liuye@...inos.cn>
Subject: [PATCH 3/4] mm/vmalloc: Remove the real_size variable to simplify the code in __vmalloc_node_range_noprof
The use of the real_size variable causes code redundancy,
so it is removed to simplify the code.
Signed-off-by: Liu Ye <liuye@...inos.cn>
---
mm/vmalloc.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index e311ee33f9ef..b4d2010e5105 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -3770,7 +3770,6 @@ void *__vmalloc_node_range_noprof(unsigned long size, unsigned long align,
struct vm_struct *area;
void *ret;
kasan_vmalloc_flags_t kasan_flags = KASAN_VMALLOC_NONE;
- unsigned long real_size = size;
unsigned long real_align = align;
unsigned int shift = PAGE_SHIFT;
@@ -3780,7 +3779,7 @@ void *__vmalloc_node_range_noprof(unsigned long size, unsigned long align,
if ((size >> PAGE_SHIFT) > totalram_pages()) {
warn_alloc(gfp_mask, NULL,
"vmalloc error: size %lu, exceeds total pages",
- real_size);
+ size);
return NULL;
}
@@ -3808,7 +3807,7 @@ void *__vmalloc_node_range_noprof(unsigned long size, unsigned long align,
bool nofail = gfp_mask & __GFP_NOFAIL;
warn_alloc(gfp_mask, NULL,
"vmalloc error: size %lu, vm_struct allocation failed%s",
- real_size, (nofail) ? ". Retrying." : "");
+ size, (nofail) ? ". Retrying." : "");
if (nofail) {
schedule_timeout_uninterruptible(1);
goto again;
@@ -3860,7 +3859,7 @@ void *__vmalloc_node_range_noprof(unsigned long size, unsigned long align,
(gfp_mask & __GFP_SKIP_ZERO))
kasan_flags |= KASAN_VMALLOC_INIT;
/* KASAN_VMALLOC_PROT_NORMAL already set if required. */
- area->addr = kasan_unpoison_vmalloc(area->addr, real_size, kasan_flags);
+ area->addr = kasan_unpoison_vmalloc(area->addr, size, kasan_flags);
/*
* In this function, newly allocated vm_struct has VM_UNINITIALIZED
@@ -3869,9 +3868,8 @@ void *__vmalloc_node_range_noprof(unsigned long size, unsigned long align,
*/
clear_vm_uninitialized_flag(area);
- size = PAGE_ALIGN(size);
if (!(vm_flags & VM_DEFER_KMEMLEAK))
- kmemleak_vmalloc(area, size, gfp_mask);
+ kmemleak_vmalloc(area, PAGE_ALIGN(size), gfp_mask);
return area->addr;
@@ -3879,7 +3877,6 @@ void *__vmalloc_node_range_noprof(unsigned long size, unsigned long align,
if (shift > PAGE_SHIFT) {
shift = PAGE_SHIFT;
align = real_align;
- size = real_size;
goto again;
}
--
2.25.1
Powered by blists - more mailing lists