There's a collision between nr_threads and external
variable with the same name.
Rename it and make module parameter named to make
change invisible to userspace.

https://virtuozzo.atlassian.net/browse/VSTOR-130116

Feature: !CONFIG_VE build
Signed-off-by: Vladimir Riabchun <[email protected]>
---
 lib/test_vmalloc.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/test_vmalloc.c b/lib/test_vmalloc.c
index 4ddf769861ff..78139224db20 100644
--- a/lib/test_vmalloc.c
+++ b/lib/test_vmalloc.c
@@ -23,7 +23,9 @@
        module_param(name, type, 0444);                 \
        MODULE_PARM_DESC(name, msg)                             \
 
-__param(int, nr_threads, 0,
+static int num_threads;
+module_param_named(nr_threads, num_threads, int, 0444);
+MODULE_PARM_DESC(nr_threads,
        "Number of workers to perform tests(min: 1 max: USHRT_MAX)");
 
 __param(bool, sequential_test_order, false,
@@ -508,10 +510,10 @@ init_test_configuration(void)
         * value and set to USHRT_MAX. We add such gap just in
         * case and for potential heavy stressing.
         */
-       nr_threads = clamp(nr_threads, 1, (int) USHRT_MAX);
+       num_threads = clamp(num_threads, 1, (int) USHRT_MAX);
 
        /* Allocate the space for test instances. */
-       tdriver = kvcalloc(nr_threads, sizeof(*tdriver), GFP_KERNEL);
+       tdriver = kvcalloc(num_threads, sizeof(*tdriver), GFP_KERNEL);
        if (tdriver == NULL)
                return -1;
 
@@ -540,7 +542,7 @@ static void do_concurrent_test(void)
         */
        down_write(&prepare_for_test_rwsem);
 
-       for (i = 0; i < nr_threads; i++) {
+       for (i = 0; i < num_threads; i++) {
                struct test_driver *t = &tdriver[i];
 
                t->task = kthread_run(test_func, t, "vmalloc_test/%d", i);
@@ -567,7 +569,7 @@ static void do_concurrent_test(void)
                ret = wait_for_completion_timeout(&test_all_done_comp, HZ);
        } while (!ret);
 
-       for (i = 0; i < nr_threads; i++) {
+       for (i = 0; i < num_threads; i++) {
                struct test_driver *t = &tdriver[i];
                int j;
 
-- 
2.47.1

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to