From owner-dev-commits-src-all@freebsd.org Sat Sep 18 10:18:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 41727674D76; Sat, 18 Sep 2021 10:18:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HBRby5xYBz3MRy; Sat, 18 Sep 2021 10:18:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9AE15279F8; Sat, 18 Sep 2021 10:18:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18IAIMhS066007; Sat, 18 Sep 2021 10:18:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18IAIMfG066006; Sat, 18 Sep 2021 10:18:22 GMT (envelope-from git) Date: Sat, 18 Sep 2021 10:18:22 GMT Message-Id: <202109181018.18IAIMfG066006@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: f902e4bb04ad - main - lockmgr: fix lock profiling of face adaptive spinning MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f902e4bb04ad717935a97ce1ae59e2dd389d940d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Sep 2021 10:18:23 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=f902e4bb04ad717935a97ce1ae59e2dd389d940d commit f902e4bb04ad717935a97ce1ae59e2dd389d940d Author: Mateusz Guzik AuthorDate: 2021-09-11 18:23:51 +0000 Commit: Mateusz Guzik CommitDate: 2021-09-18 10:16:58 +0000 lockmgr: fix lock profiling of face adaptive spinning --- 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 bec49f29d162..2eb4feb7c4b5 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -631,6 +631,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; @@ -639,8 +642,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 @@ -845,6 +846,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; @@ -852,8 +857,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