Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Jun 2021 00:40:10 GMT
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 0917d91b3344 - stable/13 - umtx: convert umtxq_lock to a macro
Message-ID:  <202106070040.1570eAKW062024@gitrepo.freebsd.org>

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

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

commit 0917d91b33444ca55b132954cc33f0d409f5a4cc
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2021-05-22 20:51:37 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2021-06-07 00:34:52 +0000

    umtx: convert umtxq_lock to a macro
    
    Then LOCK_PROFILING starts reporting callers instead of the inline.
    
    (cherry picked from commit 138f78e94bf83a8a92987d8be81f1e2c6c277cf8)
---
 sys/kern/kern_umtx.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c
index 784c10cb97ac..a1dca77fe991 100644
--- a/sys/kern/kern_umtx.c
+++ b/sys/kern/kern_umtx.c
@@ -272,7 +272,6 @@ static void umtx_shm_init(void);
 static void umtxq_sysinit(void *);
 static void umtxq_hash(struct umtx_key *key);
 static struct umtxq_chain *umtxq_getchain(struct umtx_key *key);
-static void umtxq_lock(struct umtx_key *key);
 static void umtxq_unlock(struct umtx_key *key);
 static void umtxq_busy(struct umtx_key *key);
 static void umtxq_unbusy(struct umtx_key *key);
@@ -501,15 +500,16 @@ umtxq_getchain(struct umtx_key *key)
 
 /*
  * Lock a chain.
+ *
+ * The code is a macro so that file/line information is taken from the caller.
  */
-static inline void
-umtxq_lock(struct umtx_key *key)
-{
-	struct umtxq_chain *uc;
-
-	uc = umtxq_getchain(key);
-	mtx_lock(&uc->uc_lock);
-}
+#define umtxq_lock(key) do {		\
+	struct umtx_key *_key = (key);	\
+	struct umtxq_chain *_uc;	\
+					\
+	_uc = umtxq_getchain(_key);	\
+	mtx_lock(&_uc->uc_lock);	\
+} while (0)
 
 /*
  * Unlock a chain.



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