Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1557777ybn; Wed, 2 Oct 2019 18:44:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqwTGQuCLeulyTm2TXLcWCF956RYo9a0U+3ssVJgzgoiysuxIqZv7HL3dabd9SIVpO23S4vc X-Received: by 2002:a50:ac0a:: with SMTP id v10mr6998285edc.83.1570067047657; Wed, 02 Oct 2019 18:44:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570067047; cv=none; d=google.com; s=arc-20160816; b=HpVDom0/0ShOD5YyfosooOWwiSYgdlLnJvPOBwpsM275xx2F2mg3wqjzhYeYK7rHxG VpGFYb6rz6yn0CEJdftivMgcBZfN40LIRva//jx9nGkYEQBDE5FgVQQSF8phu7l5Kgrd 92ITHtxY09uKwSxsY+F8G6V38m5QnpHWoQWcXqWpdmh5riZf8D36sHPo16g7XiwyfkSH uAgkx6iKCgexrvFRBXTrNsCkO8Xzy+HsnxcSchIi4mkVCKXnenyyqlj1mlAOGqMJNuXl qthDvwJL1GrOpL177qBDoOWbA/wSR4TsauW5lMDesuqIg37Zyj8XfidgD4cCqR257lGk dklQ== 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=vtb7bXFPF0e2ln9pnWewNbnZg9XOEVLqnDEtBGqDLUQ=; b=sO9zOqxvgakHZ7qzfy7lood/DaR/OSfti8GqEsFmPz6+Eejdf+Tx9EdkYh7K4jypRZ F3S/AIO+zw8sJbF3P7Na0pFQBh/bgDPtJ2p+YWy6FhqBcMdRS4qC/bCwRixEX2QilsUd f0qcisjbEVm8/LcoVbSRZF1v8s1dJzs5MyLRT5ZGAXLKYYfDVHMmUNakerub5+nSfiAM QNo2dJjf2npOIEKGgKUjgkLLflQMrgZyU4o9s+PukYepQHYSamepzWp0/7X//Y9JgLYZ +PX86sRVubu1GvjREtXnKwx8oJS9NP00WumcvDNzLHpzrxKFjN4B3PYjrxStYRoJETRJ yWFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NZGHP7Vr; 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 f21si495306edb.379.2019.10.02.18.43.43; Wed, 02 Oct 2019 18:44:07 -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=NZGHP7Vr; 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 S1727935AbfJCBnT (ORCPT + 99 others); Wed, 2 Oct 2019 21:43:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:46572 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727426AbfJCBnP (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 0E5F32245D; 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=tR2Ftbl9i13HtX5M9bHcSCjGuAffBub91l5STBd040o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NZGHP7VrCvyQQJJUIwd9i3qzG/fI/7dsvkeCIWw+P5a8kspjr/mUDHkOn1VhYJ2Aj 2TLVK8aXsSLhceY5Cd5uHGckiHZQUtXOdQfgxGklTwuHTEtuM1aDmrPKgb9N3vsAH3 xCZgOR+/imbnLaCY+jfIbWLXqFrbx6xWyRgVaonc= 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" , "David S. Miller" , Jiri Pirko , Ido Schimmel , Petr Machata , Paolo Abeni , netdev@vger.kernel.org Subject: [PATCH tip/core/rcu 7/9] net/core: Replace rcu_swap_protected() with rcu_replace() Date: Wed, 2 Oct 2019 18:43:08 -0700 Message-Id: <20191003014310.13262-7-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: "David S. Miller" Cc: Jiri Pirko Cc: Eric Dumazet Cc: Ido Schimmel Cc: Petr Machata Cc: Paolo Abeni Cc: --- net/core/dev.c | 4 ++-- net/core/sock_reuseport.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index bf3ed41..41f6936 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1288,8 +1288,8 @@ int dev_set_alias(struct net_device *dev, const char *alias, size_t len) } mutex_lock(&ifalias_mutex); - rcu_swap_protected(dev->ifalias, new_alias, - mutex_is_locked(&ifalias_mutex)); + new_alias = rcu_replace(dev->ifalias, new_alias, + mutex_is_locked(&ifalias_mutex)); mutex_unlock(&ifalias_mutex); if (new_alias) diff --git a/net/core/sock_reuseport.c b/net/core/sock_reuseport.c index f3ceec9..805287b 100644 --- a/net/core/sock_reuseport.c +++ b/net/core/sock_reuseport.c @@ -356,8 +356,8 @@ int reuseport_detach_prog(struct sock *sk) spin_lock_bh(&reuseport_lock); reuse = rcu_dereference_protected(sk->sk_reuseport_cb, lockdep_is_held(&reuseport_lock)); - rcu_swap_protected(reuse->prog, old_prog, - lockdep_is_held(&reuseport_lock)); + old_prog = rcu_replace(reuse->prog, old_prog, + lockdep_is_held(&reuseport_lock)); spin_unlock_bh(&reuseport_lock); if (!old_prog) -- 2.9.5