Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Jul 2021 11:10:55 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 1fc1d45374d5 - stable/13 - seqc: add symbolic name for in-modify bit
Message-ID:  <202107071110.167BAt9r040779@gitrepo.freebsd.org>

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

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

commit 1fc1d45374d58bb24c93f6eed66e1503d10cd4ee
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-04-29 22:39:23 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-07-07 10:23:20 +0000

    seqc: add symbolic name for in-modify bit
    
    (cherry picked from commit 71faea93070e6df371bf73ed12e2a1da27dc8e2d)
---
 sys/sys/seqc.h | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/sys/sys/seqc.h b/sys/sys/seqc.h
index 3cfaaf3acbda..fd9f196aceca 100644
--- a/sys/sys/seqc.h
+++ b/sys/sys/seqc.h
@@ -45,13 +45,15 @@
 
 #include <machine/cpu.h>
 
+#define	SEQC_MOD	1
+
 /*
  * Predicts from inline functions are not honored by clang.
  */
 #define seqc_in_modify(seqc)	({			\
 	seqc_t __seqc = (seqc);				\
 							\
-	__predict_false(__seqc & 1);			\
+	__predict_false(__seqc & SEQC_MOD);		\
 })
 
 static __inline void
@@ -60,7 +62,7 @@ seqc_write_begin(seqc_t *seqcp)
 
 	critical_enter();
 	MPASS(!seqc_in_modify(*seqcp));
-	*seqcp += 1;
+	*seqcp += SEQC_MOD;
 	atomic_thread_fence_rel();
 }
 
@@ -69,7 +71,7 @@ seqc_write_end(seqc_t *seqcp)
 {
 
 	atomic_thread_fence_rel();
-	*seqcp += 1;
+	*seqcp += SEQC_MOD;
 	MPASS(!seqc_in_modify(*seqcp));
 	critical_exit();
 }
@@ -85,7 +87,7 @@ static __inline seqc_t
 seqc_read_notmodify(const seqc_t *seqcp)
 {
 
-	return (atomic_load_acq_int(__DECONST(seqc_t *, seqcp)) & ~1);
+	return (atomic_load_acq_int(__DECONST(seqc_t *, seqcp)) & ~SEQC_MOD);
 }
 
 static __inline seqc_t
@@ -126,7 +128,7 @@ seqc_sleepable_write_begin(seqc_t *seqcp)
 {
 
 	MPASS(!seqc_in_modify(*seqcp));
-	*seqcp += 1;
+	*seqcp += SEQC_MOD;
 	atomic_thread_fence_rel();
 }
 
@@ -135,7 +137,7 @@ seqc_sleepable_write_end(seqc_t *seqcp)
 {
 
 	atomic_thread_fence_rel();
-	*seqcp += 1;
+	*seqcp += SEQC_MOD;
 	MPASS(!seqc_in_modify(*seqcp));
 }
 



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