Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp6048132ybg; Tue, 22 Oct 2019 12:16:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+ZBob2aJiYeVLcOy9pSyBCzvmWK8JwwK8zO0B2AN9k0Js5WVmS7FxTrdGcQeT09mCUqaB X-Received: by 2002:a05:6402:1686:: with SMTP id a6mr33154536edv.174.1571771778222; Tue, 22 Oct 2019 12:16:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571771778; cv=none; d=google.com; s=arc-20160816; b=mBRjTPPtdADgXMZDCQKZSkOeGfbt3XMHEresehdpLxRyRhHMkpeKn6bKZxkQZrYxjh wDoPC996dIL3tMKwgh9FNQlWQJVQBE7DkxmMa2KwzHcgLGn03yueiq5geVxBayZjfpqC SR2RMZFLOtEba2FoqXY91MczmJoAva1B9XgD8zpK4m1Om2ocKwApXFNUpHZyaqyQm/uq dnU3rVmzhVFKqVIRfcED443yN45xU4+SwSK8AN9ksAF+72QzXCZNl6AT2uP8a7OmID2d q82v/MQZ87/zaYGPPCpyYTr0U610uF3inTAi5b+WLKYwgY+Iwk5HfwGAHa5btZI7mEJG OSLw== 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=4nFyfVevRYfCCLEX0h/Tl/WQxCIyj9+LwFb+A2+EHIA=; b=JQUR//CIP5dirN1/HzOXng31WxAXEH2saEOPoo4g2HhUHA2GQ4vzYMnAszpC65JL3z zJo9oTBpY4JCY39WBew+3IL1BeHxKgzN1stVbagVHEVJ1j6fMq44z6D1B/Oyc90ikAk3 XplwSLWNv9/rDppPgntmVe/xXvEA+IJG0sJicY8j9mW6rDKYeghs02i3IATm1nSHOSAn 7RyP/lEbTfC+TvOmksAu2bXVSzT1v4Lkkb7scZ99MVsiQe0SoKpo+RMnf8mAZtlX3eQ8 GkjfoQA14fLoIRZGDLbvDoecomVI/i+7yz6jm07jz++tRVk00Txn7ys3Bz6kO/PX3Mkh UvAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QSQdChrx; 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 f12si3957920edc.1.2019.10.22.12.15.54; Tue, 22 Oct 2019 12:16:18 -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=QSQdChrx; 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 S2388897AbfJVTMw (ORCPT + 99 others); Tue, 22 Oct 2019 15:12:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:43770 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733029AbfJVTMf (ORCPT ); Tue, 22 Oct 2019 15:12:35 -0400 Received: from localhost.localdomain (rrcs-50-75-166-42.nys.biz.rr.com [50.75.166.42]) (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 CFC4621925; Tue, 22 Oct 2019 19:12:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571771554; bh=h6lApnQoH4yeAnt+863Onqkxe9q1Vrdvkyfiparmxl8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QSQdChrx2xCJVCgmc3ZIuW5sMYO4c5xYW9i/zxPQ5EKpxbt5Ysqzc+2hs2IT1yfVS q7BLNoQ8M0H/AVQZJKW0qtqppzRMae3AIXDxq7ywjpxd69IdaDpVUJgQaFh78xzAKh M6w6pV3AfHezs2jvBVi5DOmy1yFhHs8dHfsAQNtE= 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" , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org Subject: [PATCH tip/core/rcu 08/10] net/netfilter: Replace rcu_swap_protected() with rcu_replace() Date: Tue, 22 Oct 2019 12:12:13 -0700 Message-Id: <20191022191215.25781-8-paulmck@kernel.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20191022191136.GA25627@paulmck-ThinkPad-P72> References: <20191022191136.GA25627@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 [ paulmck: From rcu_replace() to rcu_replace_pointer() per Ingo Molnar. ] Signed-off-by: Paul E. McKenney Acked-by: 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..3379974 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_pointer(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