[DTrace-devel] [PATCH 1/2] sched: fix firing of sched:::on-cpu

Alan Maguire alan.maguire at oracle.com
Wed Jun 26 14:31:36 UTC 2024


On 25/06/2024 17:22, Alan Maguire wrote:
> sched:::on-cpu is not firing very often versus off-cpu.  It appears
> that - for recent kernels at least - fbt::schedule_tail:entry
> placement is wrong.  We can instead rely on the cpc:::context_switches-all-1

further analysis and tracing suggests this actually maps to context
switches out (i.e. off-cpu):


static inline void perf_event_task_sched_out(struct task_struct *prev,
					     struct task_struct *next)
{
 	if (__perf_sw_enabled(PERF_COUNT_SW_CONTEXT_SWITCHES))
 		__perf_sw_event_sched(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 0);
}


There are perf software events that correspond to "in" switches but this
is the wrong one; I'll try and figure out the right place to instrument
and send a v2 if I can find it..



More information about the DTrace-devel mailing list