lkml.org 
[lkml]   [2023]   [May]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH V2 3/3] tracing/timerlat: Add user-space interface
From
[...]

>
> +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

\
 
 \ /
  Last update: 2023-05-25 19:01    [W:0.175 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site