Page MenuHomeFreeBSD

lockstat: only fetch the uptime if probes are enabled
ClosedPublic

Authored by markj on Jul 14 2015, 3:38 AM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 20 2023, 1:59 AM
Unknown Object (File)
Nov 14 2023, 4:41 AM
Unknown Object (File)
Aug 4 2023, 7:19 AM
Unknown Object (File)
Aug 4 2023, 7:19 AM
Unknown Object (File)
Aug 4 2023, 7:14 AM
Unknown Object (File)
Aug 4 2023, 6:50 AM
Unknown Object (File)
Jun 15 2023, 1:14 AM
Unknown Object (File)
Jun 3 2023, 8:26 AM
Subscribers

Details

Summary

One side-effect of r284297 is that we now call lockstat_nsecs() each
time a rwlock read lock is taken, even in the uncontended case: rw_rlock
calls __rw_rlock directly rather than indirecting through some
intermediate "fast path". This is the only lock type to do so, which is
why the problem became immediately obvious when doing some lock
benchmarking.

The cost of lockstat_nsecs() can vary quite a bit between systems; in
the case of a bhyve VM, I'm seeing a slowdown of roughly 100x. I wonder
if this might also be the cause of PR 201517, i.e. something is taking a
read lock during boot, and the resulting timecounter read somehow hangs
the system.

This change uses a flag to indicate whether any lockstat probes are
actually enabled before calling binsuptime.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj retitled this revision from to lockstat: only fetch the uptime if probes are enabled.
markj edited the test plan for this revision. (Show Details)
markj updated this object.
avg edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jul 17 2015, 7:30 AM
This revision was automatically updated to reflect the committed changes.