From patchwork Sun Sep 8 22:49:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 58961 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5DEB61C1E4; Mon, 9 Sep 2019 00:50:58 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 23EAE1E9AE for ; Mon, 9 Sep 2019 00:50:51 +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 AAA6A337; Sun, 8 Sep 2019 15:50:50 -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 9B5E13F67D; Sun, 8 Sep 2019 15:50:50 -0700 (PDT) From: Honnappa Nagarahalli To: honnappa.nagarahalli@arm.com, konstantin.ananyev@intel.com Cc: dev@dpdk.org Date: Sun, 8 Sep 2019 17:49:49 -0500 Message-Id: <20190908224949.34851-8-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190908224949.34851-1-honnappa.nagarahalli@arm.com> References: <20190908224949.34851-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH 7/7] lib/rcu: update QS only when there are updates from writer X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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);