DPDK patches and discussions
 help / color / mirror / Atom feed
From: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
To: honnappa.nagarahalli@arm.com, konstantin.ananyev@intel.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 7/7] lib/rcu: update QS only when there are updates from writer
Date: Sun,  8 Sep 2019 17:49:49 -0500	[thread overview]
Message-ID: <20190908224949.34851-8-honnappa.nagarahalli@arm.com> (raw)
In-Reply-To: <20190908224949.34851-1-honnappa.nagarahalli@arm.com>

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>
---
 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


      parent reply	other threads:[~2019-09-08 22:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-08 22:49 [dpdk-dev] [PATCH 0/7] typo, doc, simple fixes and some optimizations Honnappa Nagarahalli
2019-09-08 22:49 ` [dpdk-dev] [PATCH 1/7] doc/rcu: fix typos Honnappa Nagarahalli
2019-09-08 22:49 ` [dpdk-dev] [PATCH 2/7] doc/rcu: correct the limitation on number of threads Honnappa Nagarahalli
2019-09-08 22:49 ` [dpdk-dev] [PATCH 3/7] doc/rcu: add information about storing token and resource Honnappa Nagarahalli
2019-09-08 22:49 ` [dpdk-dev] [PATCH 4/7] test/rcu: use size_t instead of int Honnappa Nagarahalli
2019-09-09 15:16   ` Ruifeng Wang (Arm Technology China)
2019-10-07 14:00     ` David Marchand
2019-09-08 22:49 ` [dpdk-dev] [PATCH 5/7] test/rcu: use correct nomenclature while printing results Honnappa Nagarahalli
2019-09-08 22:49 ` [dpdk-dev] [PATCH 6/7] lib/rcu: add least acknowledged token optimization Honnappa Nagarahalli
2019-09-08 22:49 ` Honnappa Nagarahalli [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190908224949.34851-8-honnappa.nagarahalli@arm.com \
    --to=honnappa.nagarahalli@arm.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).