Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 May 2021 17:56:46 GMT
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: e2ab16b1a6c0 - main - lockprof: move panic check after inspecting the state
Message-ID:  <202105231756.14NHukce083425@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=e2ab16b1a6c0f556299df21be54f04652ba7169d

commit e2ab16b1a6c0f556299df21be54f04652ba7169d
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2021-05-23 16:04:31 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2021-05-23 17:55:27 +0000

    lockprof: move panic check after inspecting the state
---
 sys/kern/subr_lock.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/sys/kern/subr_lock.c b/sys/kern/subr_lock.c
index ca2c6ad32f00..9bea021baac4 100644
--- a/sys/kern/subr_lock.c
+++ b/sys/kern/subr_lock.c
@@ -612,9 +612,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;
@@ -622,6 +619,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)
@@ -687,13 +688,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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105231756.14NHukce083425>