Date: Thu, 28 Jun 2018 22:14:59 +0530 From: Steevan Rodrigues <steevanxperia@gmail.com> To: Andrew Gallatin <gallatin@cs.duke.edu> Cc: freebsd-hackers@freebsd.org Subject: Re: high CPU usage in FreeBSD for a PCIe card driver Message-ID: <CAKsGTHRdArYrT33KR6Kx4CqwsTR5MRaC%2BTQfV7yTuQej4_eOXQ@mail.gmail.com> In-Reply-To: <a7caaecb-dd62-0c0f-e9ad-b83517bb3c7f@cs.duke.edu> References: <CAKsGTHR9AzX2v%2B%2BDbNCdt7RwxEfw8jKwndXzH9oxQEHvPszo%2Bw@mail.gmail.com> <a7caaecb-dd62-0c0f-e9ad-b83517bb3c7f@cs.duke.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
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@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@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAKsGTHRdArYrT33KR6Kx4CqwsTR5MRaC%2BTQfV7yTuQej4_eOXQ>