summaryrefslogtreecommitdiff
path: root/lib/librte_rcu
diff options
context:
space:
mode:
authorHonnappa Nagarahalli <honnappa.nagarahalli@arm.com>2019-10-08 16:12:20 -0500
committerDavid Marchand <david.marchand@redhat.com>2019-10-21 17:54:41 +0200
commit33466e0fe17e9dcae80f66bc340b541321f8308b (patch)
treef72e723390a7f336c6064f16083cf633041731e4 /lib/librte_rcu
parent1f90d32ce1756bfd26da913940e3ac38153c6e9a (diff)
rcu: update QS only when there are updates from writer
When the writer is checking the quiescent state status, it is not deleting any entries in the data structure. This means, the readers do not need to update their quiescent state during that period. Readers update the quiescent state only when there are updates available from the writer. Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Diffstat (limited to 'lib/librte_rcu')
-rw-r--r--lib/librte_rcu/rte_rcu_qsbr.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/librte_rcu/rte_rcu_qsbr.h b/lib/librte_rcu/rte_rcu_qsbr.h
index 3f445ba6ca..0d4664572a 100644
--- a/lib/librte_rcu/rte_rcu_qsbr.h
+++ b/lib/librte_rcu/rte_rcu_qsbr.h
@@ -456,12 +456,14 @@ rte_rcu_qsbr_quiescent(struct rte_rcu_qsbr *v, unsigned int thread_id)
*/
t = __atomic_load_n(&v->token, __ATOMIC_ACQUIRE);
- /* Inform the writer that updates are visible to this reader.
+ /* Check if there are updates available from the writer.
+ * Inform the writer that updates are visible to this reader.
* Prior loads of the shared data structure should not move
* beyond this store. Hence use store-release.
*/
- __atomic_store_n(&v->qsbr_cnt[thread_id].cnt,
- t, __ATOMIC_RELEASE);
+ if (t != __atomic_load_n(&v->qsbr_cnt[thread_id].cnt, __ATOMIC_RELAXED))
+ __atomic_store_n(&v->qsbr_cnt[thread_id].cnt,
+ t, __ATOMIC_RELEASE);
__RTE_RCU_DP_LOG(DEBUG, "%s: update: token = %"PRIu64", Thread ID = %d",
__func__, t, thread_id);