Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp6046578ybg; Tue, 22 Oct 2019 12:14:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqzrbTFrkySVOsZIoUMyzbmHgEBjE4Vj03cEJo73jO+NMJhu+E1C2UiPD5Z1fLrSyiAF8qNC X-Received: by 2002:a17:906:f1c5:: with SMTP id gx5mr5792716ejb.314.1571771688154; Tue, 22 Oct 2019 12:14:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571771688; cv=none; d=google.com; s=arc-20160816; b=VuLm9bhb3TNE17iJG7oN6SBQ+Rak8VxiSriTfuOcQCijcc+WdbXicIR525MZCqg39S Ea/MJVm1UURhi5EJ/uIIFyn5c6ykWTt6RMFe7uTZUTIntocGP3LWXARoJF+K3idrTWKF +NhsclLEPOsEbQ6s73DWkGJwqHpom/3QgNzzm+uoiHRc7JwkbPD+8JtEAq3Q9ncOwc3I P+a05xWs48/mS1eLPti5onX3jIHGTsKcJilJ4pMXqVAhqmLafjMFiDbDOKHLR60s2C92 eDpW+1ogeVJQ7KhVSWYkw1aYssWjdYflsrP0jP2vpToz+CTdVudMOAC2cLtiOmaNYK8s QM4Q== 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=9wY5j8g4FyTxtx3VTFhQjAlWp39f+f0l5KYgRa845yI=; b=pODC/AHcjjhVsbnEnm9uTW2jzp/fcrNOKZ4jJIN/urAYhoyICB816tD/wd3vaOmi/L mOOrDIgBdCor+LdwLJsU0pod5qgDsrwNuQPcopJK4JB3nb2FotMj/CefRAR2efOAmI+9 xRH7xdNQsEkfIsYj2cW83JMNGNutlPkTnGrInWvTnNC3YYcyok2VX9oJzJmS99IoM5jI B9iu7d0xPkx+wQJ4AsxL7bnXOwrC4SJNSrjPAyfyN1u4JomINGz1tKgWZlp07ZUmXqfX BX3db67J/2J8EaP7v8ECXmvtNR/MsPygNxtYtC3IWC+SXT7CwS2C9bxCY7iMbODm6slh +mWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=a7QtZqij; 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 n6si11432975ejj.232.2019.10.22.12.14.23; Tue, 22 Oct 2019 12:14:48 -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=a7QtZqij; 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 S1733027AbfJVTMe (ORCPT + 99 others); Tue, 22 Oct 2019 15:12:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:43706 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732903AbfJVTMd (ORCPT ); Tue, 22 Oct 2019 15:12:33 -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 BDA3421D71; Tue, 22 Oct 2019 19:12:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571771552; bh=tUhpaitMuoRbduLSgEqFovdvLBjMXkIUbwLYs5P9r5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a7QtZqijRRS/LJjdLOMKOOMGrCcTiPqrYAKaIY+gOdm94A9J2viGhlesoc9JwM9k8 xyab/CbLUFn0vjcSzMqFn3Rk4qz8Hd+GH17svYO4bWHeODusQyZwrtN9AHYII8TpMZ S9/BWIqe9JHcWvIBZlEXYbFRrS+RP3Wzw55EOmcQ= 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 07/10] net/core: Replace rcu_swap_protected() with rcu_replace() Date: Tue, 22 Oct 2019 12:12:12 -0700 Message-Id: <20191022191215.25781-7-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 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..c5d8882 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_pointer(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..f19f179 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_pointer(reuse->prog, old_prog, + lockdep_is_held(&reuseport_lock)); spin_unlock_bh(&reuseport_lock); if (!old_prog) -- 2.9.5