Date: Wed, 28 Dec 2016 11:28:54 +0200 From: Andriy Gapon <avg@FreeBSD.org> To: "freebsd-arch@freebsd.org" <freebsd-arch@FreeBSD.org>, freebsd-fs <freebsd-fs@FreeBSD.org> Subject: INVARIANTS vs DIAGNOSTIC % lf_advlockasync Message-ID: <2225968a-7bce-b100-f3fa-a5e2eb8b9f47@FreeBSD.org>
next in thread | raw e-mail | index | archive | help
I wonder if there are any guidelines on when to use INVARIANTS vs DIAGNOSTIC vs something else. Should the amount of output be taken into account? Or the performance impact? Or just the common sense? What I really mean is that if some sanity check could be rather expensive (e.g. it needs to iterate over a potentially long list), what option should be used to enabled it? I ask this question with one particular case in mind. lf_advlockasync() has a block of code under INVARIANTS with a loop over a list that has a nested loop over the same list for pair-wise checks. What's worse is that that code is executed with a lock held and that lock can potentially be highly contended (ls_lock). In our test environment we can observe the lock being held for as much as 125 milliseconds resulting in a huge backlog on the lock. (Even though the requested advisory locks are all shared locks and unlocks.) So, we would like to reduce the performance hit in that code, but still have the benefits of INVARIANTS enabled over all. Any suggestions are welcome. Thank you. -- Andriy Gapon
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2225968a-7bce-b100-f3fa-a5e2eb8b9f47>