linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] add parameter huge for fix_size_alloc_test
@ 2022-12-12  5:56 panqinglin2020
  0 siblings, 0 replies; only message in thread
From: panqinglin2020 @ 2022-12-12  5:56 UTC (permalink / raw)
  To: linux-mm, akpm; +Cc: ajones, Qinglin Pan

From: Qinglin Pan <panqinglin2020@iscas.ac.cn>

This patch add a parameter huge for fix_size_alloc_test
in lib/test_vmalloc.c, which can used to test allocation of
vmalloc_huge on both function and performance.

Signed-off-by: Qinglin Pan <panqinglin2020@iscas.ac.cn>

diff --git a/lib/test_vmalloc.c b/lib/test_vmalloc.c
index cf7780572f5b..5e17e0a91d60 100644
--- a/lib/test_vmalloc.c
+++ b/lib/test_vmalloc.c
@@ -38,6 +38,9 @@ __param(int, test_loop_count, 1000000,
 __param(int, nr_pages, 0,
 	"Set number of pages for fix_size_alloc_test(default: 1)");
 
+__param(bool, use_huge, false,
+	"Use vmalloc_huge in fix_size_alloc_test");
+
 __param(int, run_test_mask, INT_MAX,
 	"Set tests specified in the mask.\n\n"
 		"\t\tid: 1,    name: fix_size_alloc_test\n"
@@ -264,7 +267,10 @@ static int fix_size_alloc_test(void)
 	int i;
 
 	for (i = 0; i < test_loop_count; i++) {
-		ptr = vmalloc((nr_pages > 0 ? nr_pages:1) * PAGE_SIZE);
+		if (use_huge)
+			ptr = vmalloc_huge((nr_pages > 0 ? nr_pages:1) * PAGE_SIZE, GFP_KERNEL);
+		else
+			ptr = vmalloc((nr_pages > 0 ? nr_pages:1) * PAGE_SIZE);
 
 		if (!ptr)
 			return -1;
-- 
2.37.4



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-12  5:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-12  5:56 [PATCH v1 1/1] add parameter huge for fix_size_alloc_test panqinglin2020

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