lo2s icon indicating copy to clipboard operation
lo2s copied to clipboard

Using PERF_RECORD_MISC_SWITCH_OUT_PREEMPT

Open tilsche opened this issue 2 years ago • 3 comments

I happened to stumble across PERF_RECORD_MISC_SWITCH_OUT_PREEMPT. It is a flag that available in the misc header for PERF_RECORD_SWITCH and PERF_RECORD_SWITCH_CPU_WIDE events. It exists since 2018 (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=101592b4904ecf6b8ed2a4784d41d180319d95a1).

Now that could be useful information, but

  • It is not documented in the manpage (only in the header)
  • I have no idea how to map that to OTF2 in system monitoring mode.

tilsche avatar Nov 18 '22 20:11 tilsche

better ask "how should this be visualized"? from this we might figure a way to map it to OTF2

bertwesarg avatar Nov 21 '22 08:11 bertwesarg

how is the SWITCH event modeled into OTF2? If it is a function, why not use an attribute to the enter event, whether the bit is set or not. In Vampir you could then create a metric out of it (assuming its a numeric value) and visualize where preempt switches occurred (perf radar/overlay).

bertwesarg avatar Nov 21 '22 08:11 bertwesarg

how is the SWITCH event modeled into OTF2? If it is a function, why not use an attribute to the enter event, whether the bit is set or not. In Vampir you could then create a metric out of it (assuming its a numeric value) and visualize where preempt switches occurred (perf radar/overlay).

The "switch out" correspond to CALLING_CONTEXT_LEAVE events. I'm not really sure how this works in the process mode, but in system monitoring mode it might be difficult to find a scalable visualization - the preemption corresponds to the specific process (region). With some tracking it might be possible to derive a metric "number of currently preempted processes" to indicate over-subscription. That said I can imagine many corner cases where this tracking fails (e.g., migrations, killed threads). But also having an indication just when showing the details of the preempted process interval could already be helpful.

This might also be interesting for a current analysis we do on lo2s traces, even without any visualization.

In any case, so far it's just brainstorming.

tilsche avatar Nov 21 '22 20:11 tilsche