linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: panqinglin2020@iscas.ac.cn
To: linux-mm@kvack.org, akpm@linux-foundation.org
Cc: ajones@ventanamicro.com, Qinglin Pan <panqinglin2020@iscas.ac.cn>
Subject: [PATCH v1 1/1] add parameter huge for fix_size_alloc_test
Date: Mon, 12 Dec 2022 13:56:57 +0800	[thread overview]
Message-ID: <20221212055657.698420-1-panqinglin2020@iscas.ac.cn> (raw)

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



                 reply	other threads:[~2022-12-12  5:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221212055657.698420-1-panqinglin2020@iscas.ac.cn \
    --to=panqinglin2020@iscas.ac.cn \
    --cc=ajones@ventanamicro.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox