Commit f8bcbecf authored by Uladzislau Rezki (Sony)'s avatar Uladzislau Rezki (Sony) Committed by Linus Torvalds

lib/test_vmalloc.c: add a new 'nr_pages' parameter

In order to simulate different fixed sizes for vmalloc allocation
introduce a new parameter that sets number of pages to be allocated for
the "fix_size_alloc_test" test.

By default 1 page is used unless a different number is specified over the
new parameter.

Link: https://lkml.kernel.org/r/20210710194151.21370-1-urezki@gmail.comSigned-off-by: default avatarUladzislau Rezki (Sony) <urezki@gmail.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Hillf Danton <hdanton@sina.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Oleksiy Avramchenko <oleksiy.avramchenko@sonymobile.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 12e376a6
...@@ -35,6 +35,9 @@ __param(int, test_repeat_count, 1, ...@@ -35,6 +35,9 @@ __param(int, test_repeat_count, 1,
__param(int, test_loop_count, 1000000, __param(int, test_loop_count, 1000000,
"Set test loop counter"); "Set test loop counter");
__param(int, nr_pages, 0,
"Set number of pages for fix_size_alloc_test(default: 1)");
__param(int, run_test_mask, INT_MAX, __param(int, run_test_mask, INT_MAX,
"Set tests specified in the mask.\n\n" "Set tests specified in the mask.\n\n"
"\t\tid: 1, name: fix_size_alloc_test\n" "\t\tid: 1, name: fix_size_alloc_test\n"
...@@ -262,7 +265,7 @@ static int fix_size_alloc_test(void) ...@@ -262,7 +265,7 @@ static int fix_size_alloc_test(void)
int i; int i;
for (i = 0; i < test_loop_count; i++) { for (i = 0; i < test_loop_count; i++) {
ptr = vmalloc(3 * PAGE_SIZE); ptr = vmalloc((nr_pages > 0 ? nr_pages:1) * PAGE_SIZE);
if (!ptr) if (!ptr)
return -1; return -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment