QSBR: Use xor operation to replace add operation when changing rcu_gp.ctr value
PATCH 1/1 QSBR: Use xor operation to replace add operation when changing rcu_gp.ctr value
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.
--- src/urcu-qsbr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/urcu-qsbr.c +1 -1
@@ -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
Signature · 5 lines
2.27.0 _______________________________________________ lttng-dev mailing list [email protected] https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Quoted 3 lines · ----- On Feb 16, 2022, at 2:35 AM, lttng-dev [email protected] wrote:
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.
What is missing here is a description justifying why this change is useful.
What is inherently better about XOR compared to ADD or even binary-OR ?
If it's about performance, then a benchmark on relevant architectures would be useful. But I suspect that if end users care that much about the performance of urcu_qsbr_synchronize_rcu(), they might be doing something wrong.
Thanks,
Mathieu
Quoted 25 lines
Signed-off-by yaowenbin <[email protected]>---
src/urcu-qsbr.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)src/urcu-qsbr.c +1
-2@@ -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
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Signature · 7 lines
Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com _______________________________________________ lttng-dev mailing list [email protected] https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Quoted 6 lines · Mathieu Desnoyers
Quoted 3 lines · ----- On Feb 16, 2022, at 2:35 AM, lttng-dev [email protected] wrote:
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.
Quoted 8 lines
What is missing here is a description justifying why this change is useful.
What is inherently better about XOR compared to ADD or even binary-OR ?
If it's about performance, then a benchmark on relevant architectures would be useful. But I suspect that if end users care that much about the performance of
urcu_qsbr_synchronize_rcu(), they might be doing something wrong.
Plus having the full counter can be extremely helpful when debugging.
Thanx, Paul
Quoted 21 lines
Thanks,
Mathieu
Quoted 17 lines
Signed-off-by yaowenbin <[email protected]>---
src/urcu-qsbr.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)src/urcu-qsbr.c +1
-1@@ -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 );
Quoted 13 lines
Quoted 8 lines
src/urcu-qsbr.c +0
-1/* * Must commit urcu_qsbr_gp.ctr update to memory before waiting for -- 2.27.0
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-devSignature · 3 lines
Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev