high CPU usage in FreeBSD for a PCIe card driver
Steevan Rodrigues
steevanxperia at gmail.com
Thu Jun 28 16:45:02 UTC 2018
Thank you so much for the suggestions . I will use these commands.
Yes, I am already working on to identify lock contentions.
Re-built FreeBSD kernel by enabling lock profiling and now I am able to
see some issues with contention.
Thanks
Steevan
On Thu, Jun 28, 2018 at 6:34 PM, Andrew Gallatin <gallatin at cs.duke.edu>
wrote:
> On 06/27/18 08:28, Steevan Rodrigues wrote:
>
>> Hi
>>
>> I come from Linux background and new to FreeBSD.
>>
>> I am investigating a high CPU usage issue on FreeBSD for PCIe driver of a
>>
>
> <...>
>
>
>> I wonder whether usage of mtx_lock is the cause of high CPU usage ? Any
>> pointers or suggestions welcome.
>>
>
>
> It seems like you're experiencing lock contention. The next step is to
> determine which lock is contended and why.
>
> I would suggest using the lockstat program to identify the lock which
> is contended. Try this: lockstat -x aggsize=4m sleep 10 > out
>
> And this: lockstat -x aggsize=4m -s 10 sleep 10 > out-stacks
>
> The first will show you contended locks broken down by type. Eg:
>
>
> Adaptive mutex spin: 61262 events in 10.007 seconds (6122 events/sec)
>
> Count indv cuml rcnt nsec Lock Caller
> ------------------------------------------------------------
> -------------------
> 15958 26% 26% 0.00 2960 tcp_hpts_lck __tcp_hpts_remove+0xb5
> 11723 19% 45% 0.00 2608 tcp_hpts_lck tcp_hpts_insert_diag+0xaf
> 6903 11% 56% 0.00 4605 tcp_hpts_lck tcp_hpts_thread+0x11e
> 6834 11% 68% 0.00 125868 sleep mtxpool _sleep+0x2e3
> 2756 4% 72% 0.00 1530 vm page sendfile_free_page+0x1c1
>
>
> The second will show you the stacks associated with the lock contention,
> and may help you identify the source of contention if, for example, your
> driver is causing contention on a kernel lock.
>
> Drew
>
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
>
More information about the freebsd-hackers
mailing list