From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +THlHh1rDWLvRQAAWB0awg (envelope-from ) for ; Wed, 16 Feb 2022 16:22:37 -0500 Received: by simark.ca (Postfix, from userid 112) id 6CFB61F3C9; Wed, 16 Feb 2022 16:22:37 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.lttng.org (lists.lttng.org [167.114.26.123]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 998EF1EDF0 for ; Wed, 16 Feb 2022 16:22:36 -0500 (EST) Received: from lists-lttng01.efficios.com (localhost [IPv6:::1]) by lists.lttng.org (Postfix) with ESMTP id 4JzWBh1Dh9zSJ; Wed, 16 Feb 2022 16:22:36 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.lttng.org; s=default; t=1645046556; bh=JRQkR7+6II6mqLDw3QukhCLBAZLznXjlo1jDBEEfNpw=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=v0q3040PWU04HnzqNIP+sgpsqrnTCGSZIyOepZ7HIFEysRO4EprNRnEST7J4Z0i08 jE60LMFAO+Ew28QZve0OiJ/JbxfSmKoF61+9KrjZxjwO/XXu2+ylndo/neVsLiCCSY KctWfj2lLqlbxKgYKN7rnr8SZ3j0iIbNxHfGYymLy534UWJfx+MQgnUqhFlZjL0tDA x5wTv4f9Lu3D2+B7ulPAKAvOwC0R9qZPUxvyeGU8UkUdcQ0oRs83XNwMhbqZvbSWj7 8BirGkmMUtC7d6BTy4MqcrAnSeDhMq+iLm8UdQfA0DpiNYWQ2ZBgJjiJYBR0X9CLsb GQIfDMtDoYhFg== Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lists.lttng.org (Postfix) with ESMTPS id 4JzWBg31kTzSH for ; Wed, 16 Feb 2022 16:22:35 -0500 (EST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B6CBFB81ECF; Wed, 16 Feb 2022 21:12:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79EF4C004E1; Wed, 16 Feb 2022 21:12:41 +0000 (UTC) Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 2A1215C064D; Wed, 16 Feb 2022 13:12:41 -0800 (PST) Date: Wed, 16 Feb 2022 13:12:41 -0800 To: Mathieu Desnoyers Cc: yaowenbin , lttng-dev , wuxu wu , h00486469 Message-ID: <20220216211241.GO4285@paulmck-ThinkPad-P17-Gen-1> References: <2033818248.4933.1645044800494.JavaMail.zimbra@efficios.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2033818248.4933.1645044800494.JavaMail.zimbra@efficios.com> Subject: Re: [lttng-dev] [PATCH] QSBR: Use xor operation to replace add operation when changing rcu_gp.ctr value X-BeenThere: lttng-dev@lists.lttng.org X-Mailman-Version: 2.1.39 Precedence: list List-Id: LTTng development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Paul E. McKenney via lttng-dev" Reply-To: paulmck@kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: lttng-dev-bounces@lists.lttng.org Sender: "lttng-dev" On Wed, Feb 16, 2022 at 03:53:20PM -0500, Mathieu Desnoyers wrote: > ----- On Feb 16, 2022, at 2:35 AM, lttng-dev lttng-dev@lists.lttng.org wrote: > > > It is enough to have three values of rcu_gp.ctr, 00 for INACTIVE, > > 01 or 11 for ACTIVE. So it is possible to replace add operation > > with xor operation when changing rcu_gp.ctr value. > > What is missing here is a description justifying why this change is useful. > > What is inherently better about XOR compared to ADD or even binary-OR ? > > If it's about performance, then a benchmark on relevant architectures > would be useful. But I suspect that if end users care that much about the > performance of urcu_qsbr_synchronize_rcu(), they might be doing something > wrong. Plus having the full counter can be extremely helpful when debugging. Thanx, Paul > Thanks, > > Mathieu > > > > > Signed-off-by: yaowenbin > > --- > > src/urcu-qsbr.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/src/urcu-qsbr.c b/src/urcu-qsbr.c > > index 3709412..46135f9 100644 > > --- a/src/urcu-qsbr.c > > +++ b/src/urcu-qsbr.c > > @@ -391,7 +391,7 @@ void urcu_qsbr_synchronize_rcu(void) > > goto out; > > > > /* Increment current G.P. */ > > - CMM_STORE_SHARED(urcu_qsbr_gp.ctr, urcu_qsbr_gp.ctr + URCU_QSBR_GP_CTR); > > + CMM_STORE_SHARED(urcu_qsbr_gp.ctr, urcu_qsbr_gp.ctr ^ URCU_QSBR_GP_CTR); > > > > /* > > * Must commit urcu_qsbr_gp.ctr update to memory before waiting for > > -- > > 2.27.0 > > _______________________________________________ > > lttng-dev mailing list > > lttng-dev@lists.lttng.org > > https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > -- > Mathieu Desnoyers > EfficiOS Inc. > http://www.efficios.com _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev