<div dir="ltr">Hi<div><br></div><div>PAUSE instruction is probably part of the spinlock. This would imply that a spinlock is busy-waiting a lot</div><div><br></div><div>Jaka</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 23 Jun 2021 at 11:00, Max Lapshin <<a href="mailto:max.lapshin@gmail.com">max.lapshin@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I've clicked 'a' on this erts_schedule and see following:<br>
<br>
<br>
Percent│ mov erts_msacc_enabled,%eax<br>
│ movq $0x0,0x20(%rsp)<br>
│ test %eax,%eax<br>
│ ↓ je 7e3<br>
│ mov erts_msacc_key,%edi<br>
│ → callq ethr_tsd_get<br>
│ mov %rax,0x20(%rsp)<br>
│ 7e3: test %ebx,%ebx<br>
│ movl $0x1,0x18(%rsp)<br>
│ ↓ jne 1702<br>
│ 7f3: mov 0xb0(%r14),%eax<br>
│ test %eax,%eax<br>
│ ↓ je 1660<br>
│ movabs $0x7fffffffffffffff,%r13<br>
│ xor %ebx,%ebx<br>
│ 80e: mov $0x64,%edx<br>
│ ↓ jmp 826<br>
4.73 │ 815: subl $0x1,0x2c(%rsp)<br>
1.64 │ mov 0x2c(%rsp),%eax<br>
1.31 │ ┌──test %eax,%eax<br>
│ ├──jle 15a0<br>
0.03 │ 826:│ mov 0x18(%rbp),%r12d<br>
0.01 │ │ mov %r12d,%eax<br>
│ │ and $0x9,%eax<br>
0.67 │ │ cmp $0x9,%eax<br>
│ │↓ jne 15a0<br>
86.62 │ │ pause<br>
0.06 │ │ sub $0x1,%edx<br>
3.92 │ │↑ jne 815<br>
0.16 │ │→ callq sched_yield@plt<br>
0.00 │ │ test %eax,%eax<br>
│ │ mov $0x64,%edx<br>
<br>
<br>
<br>
<br>
82% on some instruction pause<br>
<br>
I will try to run this again on non-lcnt beam, but seems that this is<br>
somewhere around spinlock?<br>
<br>
On Wed, Jun 23, 2021 at 11:39 AM Max Lapshin <<a href="mailto:max.lapshin@gmail.com" target="_blank">max.lapshin@gmail.com</a>> wrote:<br>
><br>
> Perf report shows me things that I cannot analyse:<br>
><br>
><br>
> + 63.85% 51.25% streamer beam.lcnt.smp [.] erts_schedule<br>
> + 59.99% 0.02% streamer beam.lcnt.smp [.]<br>
> erts_dirty_process_main<br>
> + 29.50% 0.04% streamer jitted-881027-8664.so [.]<br>
> gen_server:handle_msg/6<br>
> + 25.66% 0.04% streamer jitted-881027-34178.so [.]<br>
> mpts_reader:handle_info/2<br>
><br>
><br>
> mpts_reader is my code and thanks for pointing out to me that it seems<br>
> to be the CPU eater.<br>
><br>
> I cannot understand what means that erts_schedule takes 63 / 51% of time.<br>
> Is erts_schedule a container to all functions below?<br>
</blockquote></div>