lockprof: retire lock_prof_skipcount

The implementation uses a global variable for *ALL* calls, defeating the
point of sampling in the first place. Remove it as it clearly remains
unused.
This commit is contained in:
Mateusz Guzik 2021-05-18 21:05:42 +02:00
parent 20123b25ee
commit fca5cfd584

View File

@ -278,7 +278,6 @@ static volatile int lock_prof_resetting;
static int lock_prof_rejected; static int lock_prof_rejected;
static int lock_prof_skipspin; static int lock_prof_skipspin;
static int lock_prof_skipcount;
#ifndef USE_CPU_NANOSECONDS #ifndef USE_CPU_NANOSECONDS
uint64_t uint64_t
@ -597,7 +596,6 @@ void
lock_profile_obtain_lock_success(struct lock_object *lo, int contested, lock_profile_obtain_lock_success(struct lock_object *lo, int contested,
uint64_t waittime, const char *file, int line) uint64_t waittime, const char *file, int line)
{ {
static int lock_prof_count;
struct lock_profile_object *l; struct lock_profile_object *l;
int spin; int spin;
@ -607,9 +605,6 @@ lock_profile_obtain_lock_success(struct lock_object *lo, int contested,
/* don't reset the timer when/if recursing */ /* don't reset the timer when/if recursing */
if (!lock_prof_enable || (lo->lo_flags & LO_NOPROFILE)) if (!lock_prof_enable || (lo->lo_flags & LO_NOPROFILE))
return; return;
if (lock_prof_skipcount &&
(++lock_prof_count % lock_prof_skipcount) != 0)
return;
spin = (LOCK_CLASS(lo)->lc_flags & LC_SPINLOCK) ? 1 : 0; spin = (LOCK_CLASS(lo)->lc_flags & LC_SPINLOCK) ? 1 : 0;
if (spin && lock_prof_skipspin == 1) if (spin && lock_prof_skipspin == 1)
return; return;
@ -732,8 +727,6 @@ static SYSCTL_NODE(_debug_lock, OID_AUTO, prof,
"lock profiling"); "lock profiling");
SYSCTL_INT(_debug_lock_prof, OID_AUTO, skipspin, CTLFLAG_RW, SYSCTL_INT(_debug_lock_prof, OID_AUTO, skipspin, CTLFLAG_RW,
&lock_prof_skipspin, 0, "Skip profiling on spinlocks."); &lock_prof_skipspin, 0, "Skip profiling on spinlocks.");
SYSCTL_INT(_debug_lock_prof, OID_AUTO, skipcount, CTLFLAG_RW,
&lock_prof_skipcount, 0, "Sample approximately every N lock acquisitions.");
SYSCTL_INT(_debug_lock_prof, OID_AUTO, rejected, CTLFLAG_RD, SYSCTL_INT(_debug_lock_prof, OID_AUTO, rejected, CTLFLAG_RD,
&lock_prof_rejected, 0, "Number of rejected profiling records"); &lock_prof_rejected, 0, "Number of rejected profiling records");
SYSCTL_PROC(_debug_lock_prof, OID_AUTO, stats, SYSCTL_PROC(_debug_lock_prof, OID_AUTO, stats,