From patchwork Tue Oct 8 21:12:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 175582 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6231852ill; Tue, 8 Oct 2019 14:13:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqyBzD2+jeclk0cNL6vXjmOm4a82oLDaG8K300pEGPh1tiG5ALnVRAVzW7/JxSVsJt92Itfo X-Received: by 2002:a17:906:d97a:: with SMTP id rp26mr31580625ejb.251.1570569219231; Tue, 08 Oct 2019 14:13:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570569219; cv=none; d=google.com; s=arc-20160816; b=oLoOULlyhAcJMri1zjadLsTG+F/jD66cmoLTkPSDVqPWfkx8yvuE0Rn423HXvzUfro evTuSPWzEl4hfIZ8d8Kmk3hQ8ZQKR3gUOuMxihA331rdQx2gupD/RbldL4+VXoGkLTYO 2l1PiOOa4NSgATXrY5tVr06KUlLRpqdKR+oTKk595CZ1HQc+/GBgvk2vuGSrR19qYTZC 3q7SSvvOK6MmwekLMNglllMJ+FR2PgCjx8gGieO32TrtDZCqUMKkwfYJUAeHYgMTkIum vRd2vQ+Z2cq3oFLQvYpTN3HLpFt5LK71kn4lgE/TE0gBWw3fpqAWyX+3BWltX49uaWkt 4JEQ== 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=nxc/BnNuAgVNw6ykwJnOI2/1LvXnsV5qpycKqm7VNevAdAuZjKQHEf2iCfDd+HuS3Z C10BP+dm2egd495G5Ue5VwuD0/C6iloptqxhrYPsSSauzI2bV9q/79loyVZxiuyMq8EO k0g1QZWf0MO96qFCCB3lofMnWNAsPDt16l5dRf1KSt9gCN8uaMOkjmvM9CTQfAY/VsdV F3Vd21Bz906RXtiWHbfy32N/oH2bj00sDumuUWxK2NF1AEWtRXhdJSQnWnlQ/w00M3tO onmSEnPk7BNP1/mcp9JWWv88TBZfh2zCXZJbjkGdmmYMmcml5vT9G4pgOoslHcfcXkku E/jA== 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 x51si160507edd.193.2019.10.08.14.13.39; Tue, 08 Oct 2019 14:13:39 -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 D85101D453; Tue, 8 Oct 2019 23:12:55 +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-dev] [PATCH v2 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);