Skip to content

Commit

Permalink
lib/test_vmalloc.c: add a new 'nr_pages' parameter
Browse files Browse the repository at this point in the history
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/[email protected]
Signed-off-by: Uladzislau Rezki (Sony) <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Cc: Nicholas Piggin <[email protected]>
Cc: Hillf Danton <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Oleksiy Avramchenko <[email protected]>
Cc: Steven Rostedt <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
urezki authored and torvalds committed Sep 3, 2021
1 parent 12e376a commit f8bcbec
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/test_vmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ __param(int, test_repeat_count, 1,
__param(int, test_loop_count, 1000000,
"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,
"Set tests specified in the mask.\n\n"
"\t\tid: 1, name: fix_size_alloc_test\n"
Expand Down Expand Up @@ -262,7 +265,7 @@ static int fix_size_alloc_test(void)
int 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)
return -1;
Expand Down

0 comments on commit f8bcbec

Please sign in to comment.