We can get here on timerlat with OSN_WORKLOAD cleared via
osnoise_hotplug_workfn().

While we're moving this code, remove the pointless compiler barrier
immediately before returning from a function.  Even if it's inlined,
it's not doing anything useful.

Signed-off-by: Crystal Wood <[email protected]>
---
 kernel/trace/trace_osnoise.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index a53a07e59197..0f27af6ade3e 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -2056,16 +2056,17 @@ static int start_kthread(unsigned int cpu)
        if (osn->kthread)
                goto out;
 
+       /* Can still happen with timerlat via cpu hotplug */
+       if (!test_bit(OSN_WORKLOAD, &osnoise_options)) {
+               if (!timerlat_enabled())
+                       osn->sampling = true;
+               goto out;
+       }
+
        if (timerlat_enabled()) {
                snprintf(comm, 24, "timerlat/%d", cpu);
                main = timerlat_main;
        } else {
-               /* if no workload, just return */
-               if (!test_bit(OSN_WORKLOAD, &osnoise_options)) {
-                       per_cpu(per_cpu_osnoise_var, cpu).sampling = true;
-                       barrier();
-                       goto out;
-               }
                snprintf(comm, 24, "osnoise/%d", cpu);
        }
 
-- 
2.54.0


Reply via email to