[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210324150518.2734402-4-willy@infradead.org>
Date: Wed, 24 Mar 2021 15:05:17 +0000
From: "Matthew Wilcox (Oracle)" <willy@...radead.org>
To: linux-mm@...ck.org
Cc: "Matthew Wilcox (Oracle)" <willy@...radead.org>,
linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Christoph Lameter <cl@...ux.com>,
Pekka Enberg <penberg@...nel.org>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Vlastimil Babka <vbabka@...e.cz>,
Uladzislau Rezki <urezki@...il.com>,
Nicholas Piggin <npiggin@...il.com>
Subject: [PATCH v2 3/4] mm/vmalloc: Use kvmalloc to allocate the table of pages
If we're trying to allocate 4MB of memory, the table will be 8KiB in size
(1024 pointers * 8 bytes per pointer), which can usually be satisfied
by a kmalloc (which is significantly faster). Instead of changing this
open-coded implementation, just use kvmalloc().
This improves the allocation speed of vmalloc(4MB) by approximately
5% in our benchmark. It's still dominated by the 1024 calls to
alloc_pages_node(), which will be the subject of a later patch.
Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
---
mm/vmalloc.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index a22241e9c363..a9ed2a4b697e 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2801,13 +2801,8 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
gfp_mask |= __GFP_HIGHMEM;
/* Please note that the recursion is strictly bounded. */
- if (array_size > PAGE_SIZE) {
- pages = __vmalloc_node(array_size, 1, nested_gfp, node,
+ pages = kvmalloc_node_caller(array_size, nested_gfp, node,
area->caller);
- } else {
- pages = kmalloc_node(array_size, nested_gfp, node);
- }
-
if (!pages) {
free_vm_area(area);
return NULL;
--
2.30.2
Powered by blists - more mailing lists