Thursday, July 01, 2021

Re: Source of the spin

On 2021-06-30, Sven F. <sven.falempin@gmail.com> wrote:
> On Wed, Jun 30, 2021 at 4:15 AM Stuart Henderson <stu@spacehopper.org> wrote:
>>
>> On 2021-06-29, Sven F. <sven.falempin@gmail.com> wrote:
>> > Dear readers,
>> >
>> > I probably did something silly again,
>> > Could you help with a bit of knowledge around performance ?
>> > My openbsd CPU (6.8) is spinning a lot :
>> >
>> > 0.0%Int 53.1%Spn 25.8%Sys 19.6%Usr 1.4%Idle
>> >
>> > * Is this bad ?
>> > * What kind of basic operation ( like basic shell scripting ) could do that ? ?
>> >
>> > Thank you,
>> >
>>
>> This means the kernel is spending a lot of time waiting for other CPUs
>> to exit locked sections.
>>
>> First things first, try 6.9, the malloc cache implementation changed
>> and that may help.
>>
>>
>
> Thank you,
>
> Can I use ktrace to check where the lock comes from ( can't really put
> 6.9 easily to test ) ?
> Will try to get 6.9 anyway, but it would be either to know what i need to test.

If it's due to a userland process then possibly, as might ltrace. To use
either of these you will need to already know *what* process is involved,
and it is not particularly easy to figure out from the output which
calls/functions result in high cpu use.

Using dt(4)/btrace and generating a flamegraph gives a view of what's
happening in the kernel (it was not enabled by default until after 6.9
so you will need a kernel built with modified config to use it).

See https://marc.info/?l=openbsd-bugs&m=158583371404603&w=2 but also
see mpi's other posts in the thread. But this is a lot of work to do if
it is something that has already been improved in the OS.

No comments:

Post a Comment