aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/subr_lock.c
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2021-05-23 16:04:31 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2021-06-02 15:00:23 +0000
commit66eda48003ae7f320f2975123783c7f47c93ca1a (patch)
tree2a58bfd572b1b503eaec22b92198c3bc31bf3973 /sys/kern/subr_lock.c
parent4ee784e4d8db2da6b53fc5792fc6ee565d6a7cee (diff)
downloadsrc-66eda48003ae7f320f2975123783c7f47c93ca1a.tar.gz
src-66eda48003ae7f320f2975123783c7f47c93ca1a.zip
lockprof: move panic check after inspecting the state
(cherry picked from commit e2ab16b1a6c0f556299df21be54f04652ba7169d)
Diffstat (limited to 'sys/kern/subr_lock.c')
-rw-r--r--sys/kern/subr_lock.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/kern/subr_lock.c b/sys/kern/subr_lock.c
index 7c3bfec3ea40..36ba9125e176 100644
--- a/sys/kern/subr_lock.c
+++ b/sys/kern/subr_lock.c
@@ -611,9 +611,6 @@ lock_profile_obtain_lock_success(struct lock_object *lo, bool spin,
lo->lo_name, spin, is_spin);
#endif
- if (SCHEDULER_STOPPED())
- return;
-
/* don't reset the timer when/if recursing */
if (!lock_prof_enable || (lo->lo_flags & LO_NOPROFILE))
return;
@@ -621,6 +618,10 @@ lock_profile_obtain_lock_success(struct lock_object *lo, bool spin,
return;
if (spin && lock_prof_skipspin == 1)
return;
+
+ if (SCHEDULER_STOPPED())
+ return;
+
critical_enter();
/* Recheck enabled now that we're in a critical section. */
if (lock_prof_enable == 0)
@@ -686,13 +687,13 @@ lock_profile_release_lock(struct lock_object *lo, bool spin)
lo->lo_name, spin, is_spin);
#endif
- if (SCHEDULER_STOPPED())
- return;
if (lo->lo_flags & LO_NOPROFILE)
return;
head = &curthread->td_lprof[spin];
if (LIST_FIRST(head) == NULL)
return;
+ if (SCHEDULER_STOPPED())
+ return;
critical_enter();
/* Recheck enabled now that we're in a critical section. */
if (lock_prof_enable == 0 && lock_prof_resetting == 1)