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: 173354 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3622522ilq; Sun, 8 Sep 2019 15:51:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqysfhMOUX7vc74rDO45vq20Y1v7rCXbWwyQVAL1dRGUKHNmDSnndWB6ZRD1AaAcu6c4zUYs X-Received: by 2002:a1c:a552:: with SMTP id o79mr16122066wme.91.1567983091384; Sun, 08 Sep 2019 15:51:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567983091; cv=none; d=google.com; s=arc-20160816; b=kNWYanMxHtiDNs8pEiNdkgm2ZY6lcwDH06M+TFO/Pg1X2ex5vXh46AptYywXcTCpLl MPu4PD5YnmdffGLafOgHMU3cBG6iTKM+j3FZrZXaV5MFvUttkEjr/hxq3jOYCU5Xmeuy x4+UWG9bjt9kgSC4amFIkGDxfIUZa8C7cMFrqoVYlnH6KZ2Jf2pWwM++p6rvZtMX8q0f qGecSI1Mvw5qvlJc3umqZGwi0BYPz2VJWw+qG+291AGDoTMcengQk4G7iAgxfgedBA2g 98LLTm7ronlACM+MlsQkgdd8iy8gzdwYEUKtBqSwwcC8s6MMBS9LpyPhq4Y9ZuuC6Wxs oPTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=Z2ijQeeAsuHGJzpikFMphUyLtyd5thKe6cAYSbAgR5c=; b=0iKsA37JyF4XJByeGLtJViuxf2sN2DOMVm0NKl7bwXmV51K5u1kJLaqWytZ8wxcq9d asXnpgMsIM/gNoN/+sc+LUIs9/ymTnRibnuyeGmpw4uQYaohT2JaqXSzk1dKrW+0u3aZ K4vEDlDTFkJkBDHs3GhIDp/i4vu2D+Do4pvl3/bF2WI7vCYvulqdIBpGexcd4YXooXhz 9DGGJiMdHTLoJFcvIxD4UtIvWKUiOTvcRLWGDKAJRrOOPf6aidr/CAvXxgH5oW81OxaZ NzDz4Rp8mblGa+kH+qcgSWMFirHj6GEojYOWt5dNoFBWSQ5awZCkGSp1OVkpGWGavxV2 rmzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id e5si7013008wme.144.2019.09.08.15.51.31; Sun, 08 Sep 2019 15:51:31 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@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(-) -- 2.17.1 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);