From: yaowenbin via lttng-dev <lttng-dev@lists.lttng.org>
To: <lttng-dev@lists.lttng.org>
Cc: <yaowenbin1@huawei.com>, <wuxu.wu@huawei.com>,
"hewenliang (C)" <hewenliang4@huawei.com>
Subject: [lttng-dev] [PATCH] QSBR: Use xor operation to replace add operation when changing rcu_gp.ctr value
Date: Wed, 16 Feb 2022 15:35:11 +0800 [thread overview]
Message-ID: <bb4a9de6-3adb-bec0-1bf1-22dd25a8d5c0@huawei.com> (raw)
It is enough to have three values of rcu_gp.ctr, 00 for INACTIVE,
01 or 11 for ACTIVE. So it is possible to replace add operation
with xor operation when changing rcu_gp.ctr value.
Signed-off-by: yaowenbin <yaowenbin1@huawei.com>
---
src/urcu-qsbr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/urcu-qsbr.c b/src/urcu-qsbr.c
index 3709412..46135f9 100644
--- a/src/urcu-qsbr.c
+++ b/src/urcu-qsbr.c
@@ -391,7 +391,7 @@ void urcu_qsbr_synchronize_rcu(void)
goto out;
/* Increment current G.P. */
- CMM_STORE_SHARED(urcu_qsbr_gp.ctr, urcu_qsbr_gp.ctr + URCU_QSBR_GP_CTR);
+ CMM_STORE_SHARED(urcu_qsbr_gp.ctr, urcu_qsbr_gp.ctr ^ URCU_QSBR_GP_CTR);
/*
* Must commit urcu_qsbr_gp.ctr update to memory before waiting for
--
2.27.0
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
next reply other threads:[~2022-02-16 17:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-16 7:35 yaowenbin via lttng-dev [this message]
2022-02-16 20:53 ` Mathieu Desnoyers via lttng-dev
2022-02-16 21:12 ` Paul E. McKenney via lttng-dev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bb4a9de6-3adb-bec0-1bf1-22dd25a8d5c0@huawei.com \
--to=lttng-dev@lists.lttng.org \
--cc=hewenliang4@huawei.com \
--cc=wuxu.wu@huawei.com \
--cc=yaowenbin1@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox