rcuscale: Warn on individual rcu_scale_init() error conditions
authorPaul E. McKenney <paulmck@kernel.org>
Thu, 5 Aug 2021 22:58:53 +0000 (15:58 -0700)
committerPaul E. McKenney <paulmck@kernel.org>
Mon, 13 Sep 2021 23:36:16 +0000 (16:36 -0700)
When running rcuscale as a module, any rcu_scale_init() issues will be
reflected in the error code from modprobe or insmod, as the case may be.
However, these error codes are not available when running rcuscale
built-in, for example, when using the kvm.sh script.  This commit
therefore adds WARN_ON_ONCE() to allow distinguishing rcu_scale_init()
errors when running rcuscale built-in.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/rcu/rcuscale.c

index 2cc34a2..228f143 100644 (file)
@@ -758,7 +758,7 @@ kfree_scale_init(void)
                init_waitqueue_head(&shutdown_wq);
                firsterr = torture_create_kthread(kfree_scale_shutdown, NULL,
                                                  shutdown_task);
-               if (firsterr)
+               if (torture_init_error(firsterr))
                        goto unwind;
                schedule_timeout_uninterruptible(1);
        }
@@ -775,7 +775,7 @@ kfree_scale_init(void)
        for (i = 0; i < kfree_nrealthreads; i++) {
                firsterr = torture_create_kthread(kfree_scale_thread, (void *)i,
                                                  kfree_reader_tasks[i]);
-               if (firsterr)
+               if (torture_init_error(firsterr))
                        goto unwind;
        }
 
@@ -838,7 +838,7 @@ rcu_scale_init(void)
                init_waitqueue_head(&shutdown_wq);
                firsterr = torture_create_kthread(rcu_scale_shutdown, NULL,
                                                  shutdown_task);
-               if (firsterr)
+               if (torture_init_error(firsterr))
                        goto unwind;
                schedule_timeout_uninterruptible(1);
        }
@@ -852,7 +852,7 @@ rcu_scale_init(void)
        for (i = 0; i < nrealreaders; i++) {
                firsterr = torture_create_kthread(rcu_scale_reader, (void *)i,
                                                  reader_tasks[i]);
-               if (firsterr)
+               if (torture_init_error(firsterr))
                        goto unwind;
        }
        while (atomic_read(&n_rcu_scale_reader_started) < nrealreaders)
@@ -879,7 +879,7 @@ rcu_scale_init(void)
                }
                firsterr = torture_create_kthread(rcu_scale_writer, (void *)i,
                                                  writer_tasks[i]);
-               if (firsterr)
+               if (torture_init_error(firsterr))
                        goto unwind;
        }
        torture_init_end();