Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1559588ybn; Wed, 2 Oct 2019 18:46:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQHAUCSfXt75LEDqwjKdPVaboHdUMavotozIWzSyR5Z7P9BoZ7ygtLP7gQelfweFZQExsx X-Received: by 2002:a50:a8a2:: with SMTP id k31mr6938993edc.79.1570067195233; Wed, 02 Oct 2019 18:46:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570067195; cv=none; d=google.com; s=arc-20160816; b=Y2biZXkZjP7B8va68G6cbvPtSHzeLz1P2cIkY6y+Gsh7863KMNl+Uj6tRAL4Qj9aCs qG30L5TjJJAgC4r4uzk4gSunBjsdcg3GaWlKBlyYpzOjRH3ME0EF2s8yTm3uB6627DTv rIVqBOsv+tocVn4OLOquHB5qXDpmByLuDv+ZoXOD7VSamT+gboywUO4u5x14IBUJX+zH 3QLQSmLVc6N4NbHpixVuN2asS/09UbinrUWF6N36VfcsogOnNmySyQPXO+R1t1eaKAtL ErrEUz04/DhJbFWj9bo+nT1M324/hGNYsxNm4bkn2RdZQdB0tRyhWFld3xnCavvP8FDy 4sZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=xeDOZgmvluUFpmqvlTB5/SzLtcFJcuYAHt6s3Spz8qo=; b=gcGzEd14zTIAa/BgDSt1/790nvSvOxK9C5lnTqTvwIcVtKSOMspKOy3+gRErYedDn4 tSNY6MK7lpwnBVCasDf102DMyrg+Jq3+L/gOIs0agys2IWnTNNfVtq+Kpk4qzVBSQSic xhhbxs0oZrI5Gk/kYwm7hysDP24Zu+5ZCnHvSYYFTPJe4Cy4GggrNGbUlQp89sftQnva dqaXcYKO1vvlIRtzzJbIWCnMDVmpVipGc7jO8fioRp3LEZwBI863BL8Cmmk6/+GsazPo wlqS13faeNTEaAqldogacSRZT0XdWllgsPGbq6+DneJ3Je381xIvTXhMguE6/EW8xKTr n3/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hme6n4Ct; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u2si449518ejr.332.2019.10.02.18.46.11; Wed, 02 Oct 2019 18:46:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hme6n4Ct; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727624AbfJCBnR (ORCPT + 99 others); Wed, 2 Oct 2019 21:43:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:46612 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725799AbfJCBnP (ORCPT ); Wed, 2 Oct 2019 21:43:15 -0400 Received: from paulmck-ThinkPad-P72.home (50-39-105-78.bvtn.or.frontiernet.net [50.39.105.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6FAF4222D0; Thu, 3 Oct 2019 01:43:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570066994; bh=xq8wmWF+0DYuEKeGS/ddPyJZMDAJsFE60aB2Uqwti3Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hme6n4Ct0Suv+l2Qm305v/Ju/zEgOuS6xD0Vf/X69g2ny2htKdl2dMRUzrx6JpTUy SZqldfIaXWvz29wFwhciGdLHURIzm2ZMuldSVe9XUp0RVFlsA/iUzSWRqmDKsSe+eU 9M4hFETLInKX3BGorqhaibyKIJx9R2Ls61MSmgcA= From: paulmck@kernel.org To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com, fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org, "Paul E. McKenney" , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org Subject: [PATCH tip/core/rcu 8/9] net/netfilter: Replace rcu_swap_protected() with rcu_replace() Date: Wed, 2 Oct 2019 18:43:09 -0700 Message-Id: <20191003014310.13262-8-paulmck@kernel.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20191003014153.GA13156@paulmck-ThinkPad-P72> References: <20191003014153.GA13156@paulmck-ThinkPad-P72> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Paul E. McKenney" This commit replaces the use of rcu_swap_protected() with the more intuitively appealing rcu_replace() as a step towards removing rcu_swap_protected(). Link: https://lore.kernel.org/lkml/CAHk-=wiAsJLw1egFEE=Z7-GGtM6wcvtyytXZA1+BHqta4gg6Hw@mail.gmail.com/ Reported-by: Linus Torvalds Signed-off-by: Paul E. McKenney Cc: Pablo Neira Ayuso Cc: Jozsef Kadlecsik Cc: Florian Westphal Cc: "David S. Miller" Cc: Cc: Cc: --- net/netfilter/nf_tables_api.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index d481f9b..8499baf 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -1461,8 +1461,9 @@ static void nft_chain_stats_replace(struct nft_trans *trans) if (!nft_trans_chain_stats(trans)) return; - rcu_swap_protected(chain->stats, nft_trans_chain_stats(trans), - lockdep_commit_lock_is_held(trans->ctx.net)); + nft_trans_chain_stats(trans) = + rcu_replace(chain->stats, nft_trans_chain_stats(trans), + lockdep_commit_lock_is_held(trans->ctx.net)); if (!nft_trans_chain_stats(trans)) static_branch_inc(&nft_counters_enabled); -- 2.9.5