From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 19197A2F6B for ; Tue, 8 Oct 2019 23:13:02 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9A23E1D50B; Tue, 8 Oct 2019 23:12:57 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 137581C192; Tue, 8 Oct 2019 23:12:45 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 95BF115BE; Tue, 8 Oct 2019 14:12:44 -0700 (PDT) Received: from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com [10.118.12.34]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 857DE3F68E; Tue, 8 Oct 2019 14:12:44 -0700 (PDT) From: Honnappa Nagarahalli To: honnappa.nagarahalli@arm.com, david.marchand@redhat.com, konstantin.ananyev@intel.com Cc: dev@dpdk.org, ruifeng.wang@arm.com, stable@dpdk.org, nd@arm.com Date: Tue, 8 Oct 2019 16:12:20 -0500 Message-Id: <20191008211220.31586-8-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191008211220.31586-1-honnappa.nagarahalli@arm.com> References: <20191008211220.31586-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-stable] [PATCH v2 7/7] lib/rcu: update QS only when there are updates from writer X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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 Reviewed-by: Gavin Hu --- lib/librte_rcu/rte_rcu_qsbr.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/librte_rcu/rte_rcu_qsbr.h b/lib/librte_rcu/rte_rcu_qsbr.h index 3f445ba6c..0d4664572 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); -- 2.17.1