workqueue: Simplify a pr_warn() call in wq_select_unbound_cpu()
authorAmmar Faizi <ammarfaizi2@gnuweeb.org>
Sun, 26 Feb 2023 16:53:20 +0000 (23:53 +0700)
committerTejun Heo <tj@kernel.org>
Fri, 17 Mar 2023 21:49:03 +0000 (11:49 -1000)
Use pr_warn_once() to achieve the same thing. It's simpler.

Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Reviewed-by: Lai Jiangshan <jiangshanlai@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/workqueue.c

index b8b541c..3f1fabe 100644 (file)
@@ -1392,15 +1392,13 @@ static bool is_chained_work(struct workqueue_struct *wq)
  */
 static int wq_select_unbound_cpu(int cpu)
 {
-       static bool printed_dbg_warning;
        int new_cpu;
 
        if (likely(!wq_debug_force_rr_cpu)) {
                if (cpumask_test_cpu(cpu, wq_unbound_cpumask))
                        return cpu;
-       } else if (!printed_dbg_warning) {
-               pr_warn("workqueue: round-robin CPU selection forced, expect performance impact\n");
-               printed_dbg_warning = true;
+       } else {
+               pr_warn_once("workqueue: round-robin CPU selection forced, expect performance impact\n");
        }
 
        if (cpumask_empty(wq_unbound_cpumask))