Date: Wed, 23 Jun 2021 20:47:21 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 71faea93070e - main - seqc: add symbolic name for in-modify bit Message-ID: <202106232047.15NKlLGA009693@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=71faea93070e6df371bf73ed12e2a1da27dc8e2d commit 71faea93070e6df371bf73ed12e2a1da27dc8e2d Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-04-29 22:39:23 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-06-23 20:46:15 +0000 seqc: add symbolic name for in-modify bit Reviewed by: mckusick Discussed with: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30041 --- 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?202106232047.15NKlLGA009693>