From patchwork Wed Feb 16 07:35:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yaowenbin X-Patchwork-Id: 3737142 From: yaowenbin1 at huawei.com (yaowenbin) Date: Wed, 16 Feb 2022 15:35:11 +0800 Subject: [lttng-dev] [PATCH] QSBR: Use xor operation to replace add operation when changing rcu_gp.ctr value Message-ID: 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 --- 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