git: 32c7c1d3945f - stable/13 - lockmgr: fix lock profiling of face adaptive spinning
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 11 Oct 2021 09:15:46 UTC
The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=32c7c1d3945f9e4b4c59a0f9bc2bdb054dd5b446 commit 32c7c1d3945f9e4b4c59a0f9bc2bdb054dd5b446 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2021-09-11 18:23:51 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> CommitDate: 2021-10-11 09:09:55 +0000 lockmgr: fix lock profiling of face adaptive spinning (cherry picked from commit f902e4bb04ad717935a97ce1ae59e2dd389d940d) --- sys/kern/kern_lock.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index c86dad2218d4..e90c55947676 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -623,6 +623,9 @@ lockmgr_slock_hard(struct lock *lk, u_int flags, struct lock_object *ilk, if (lockmgr_slock_try(lk, &x, flags, false)) break; + lock_profile_obtain_lock_failed(&lk->lock_object, false, + &contested, &waittime); + if ((flags & (LK_ADAPTIVE | LK_INTERLOCK)) == LK_ADAPTIVE) { if (lockmgr_slock_adaptive(&lda, lk, &x, flags)) continue; @@ -631,8 +634,6 @@ lockmgr_slock_hard(struct lock *lk, u_int flags, struct lock_object *ilk, #ifdef HWPMC_HOOKS PMC_SOFT_CALL( , , lock, failed); #endif - lock_profile_obtain_lock_failed(&lk->lock_object, false, - &contested, &waittime); /* * If the lock is expected to not sleep just give up @@ -837,6 +838,10 @@ lockmgr_xlock_hard(struct lock *lk, u_int flags, struct lock_object *ilk, break; continue; } + + lock_profile_obtain_lock_failed(&lk->lock_object, false, + &contested, &waittime); + if ((flags & (LK_ADAPTIVE | LK_INTERLOCK)) == LK_ADAPTIVE) { if (lockmgr_xlock_adaptive(&lda, lk, &x)) continue; @@ -844,8 +849,6 @@ lockmgr_xlock_hard(struct lock *lk, u_int flags, struct lock_object *ilk, #ifdef HWPMC_HOOKS PMC_SOFT_CALL( , , lock, failed); #endif - lock_profile_obtain_lock_failed(&lk->lock_object, false, - &contested, &waittime); /* * If the lock is expected to not sleep just give up