Messages in this thread | | | Date | Thu, 25 May 2023 19:00:41 +0200 | Subject | Re: [PATCH V2 3/3] tracing/timerlat: Add user-space interface | From | Daniel Bristot de Oliveira <> |
| |
[...]
> > +static void check_timerlat_user_migration(pid_t pid, long dest_cpu); > /* > * trace_sched_switch - sched:sched_switch trace event handler > * > @@ -1196,6 +1199,9 @@ trace_sched_switch_callback(void *data, bool preempt, > struct osnoise_variables *osn_var = this_cpu_osn_var(); > int workload = test_bit(OSN_WORKLOAD, &osnoise_options); > > + if (unlikely(workload && timerlat_enabled())) > + check_timerlat_user_migration(n->pid, smp_processor_id()); > +
it should be !workload, anyway, I will move this check to a sched_migrate_task tracepoint because it runs less frequently and...
[...]
the tracepoint also informs the origin CPU, so it can be passed here:
> + > +static void check_timerlat_user_migration(pid_t pid, long dest_cpu) > +{ > + struct osnoise_variables *osn_var; > + long cpu; > +
and we can avoid this ugly loop.
> + for_each_possible_cpu(cpu) { > + osn_var = per_cpu_ptr(&per_cpu_osnoise_var, cpu); > + if (osn_var->pid == pid && dest_cpu != cpu) { > + per_cpu_ptr(&per_cpu_timerlat_var, cpu)->uthread_migrate = 1; > + osnoise_taint("timerlat user thread migrate\n"); > + osnoise_stop_tracing(); > + break; > + } > + }
Lazy daniel should have had a look first, but at least now I know I also need to do some ifdeffery.
-- Daniel
| |