Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1557845ybn; Wed, 2 Oct 2019 18:44:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYqej69a6DHgFZwUpLFOnrzwUIouBeY3RRt3Xp3jFctYg9dATKW67Gy5qCHUcn5id+KRJk X-Received: by 2002:a50:cfc7:: with SMTP id i7mr6886231edk.89.1570067051430; Wed, 02 Oct 2019 18:44:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570067051; cv=none; d=google.com; s=arc-20160816; b=mMlDUKc86+nzRMf8J1CDqF3kXw/2GWuIXnmw7aSXxEbWXjVWhq6qsodE+4EUJCV2hd N7D9/BBqXRbw07t+EZ1cqTRL8+3LZwEzf11/xZH4SkqG4xEHr+rzSrrllyzVqCcSSgNS WYHJqdE+cGSbVSF1K8jD12M/K9UKe5JHyJCmT5swxG/lh7UjYeiFi+YdTYQOyY51BcTm 6Lud9Eu4vn2O7xVVhKsoVTHakkyWG4K2k5jc+oDgispqm+bHx7mHSjdBjHtN9iItupjm MzVYTFYl0Ho/PXOWYejkFJa+icq8jM3adD6D+9pCTAhJ9lwuFjc6kKNQvQ0KuyK9ymdc SXUQ== 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=FvKgE16OWrCsJ+VO94PMMA7b74D0WxJtPyUDJ2wXMHU=; b=vCleNIUNQs1cr5OQ7d2WyVZxb55Lg0it0mWaV6pLVNQf9JhpVICzD94B8LBQrD/StO HSt57GAYlO7VF3iQR+hUPcCYnkW1oiejw84tP26ujXFM0YQZyJQf6pA4AiUv//eBRiT/ SGDZhXERkYpTPeIx3NRCxG9ixLdFCQ7xrz2fz0xn0z37cxewRRPPwtGu6kVWdyj0gEqZ kx1RQCU5SrtnYnkNSu9ziMUSirKKOQsAxYNGzHdrwkqi/mL22AfUvn4EcJPPQ6J9VDJm /Q1M1aHRKZWPWusMKm6s2zLfyGGUiHMjniYYSnQvuzrSQ5nRron9pt1SPTXxpVrjiq6b 9hew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=go9gL1rn; 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 b58si591280edc.97.2019.10.02.18.43.47; Wed, 02 Oct 2019 18:44:11 -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=go9gL1rn; 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 S1728017AbfJCBnV (ORCPT + 99 others); Wed, 2 Oct 2019 21:43:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:46538 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727385AbfJCBnO (ORCPT ); Wed, 2 Oct 2019 21:43:14 -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 9BA6A222C4; Thu, 3 Oct 2019 01:43:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570066993; bh=Zw0CRg+Lnjau6ZnXDxzvWs0DBHdnwFB+dQFY5Z45GsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=go9gL1rnB+9IEoHYvnOLiKjNS2+W58Kc/zUmQlnZIKemEw2TUdDyRwiblmrRcxRls nxAr15o7woTpFk1UHmdqdOH9ekEXNI4qm2Svwi7T1wI8qhn5FZcKXvhu3j/+MgyRgg FHfrHLuTySOI08VpQl9xR5GIjlstNJL2A8jLbV/8= 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" , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH tip/core/rcu 6/9] bpf/cgroup: Replace rcu_swap_protected() with rcu_replace() Date: Wed, 2 Oct 2019 18:43:07 -0700 Message-Id: <20191003014310.13262-6-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: Alexei Starovoitov Cc: Daniel Borkmann Cc: Martin KaFai Lau Cc: Song Liu Cc: Yonghong Song Cc: Cc: --- kernel/bpf/cgroup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c index ddd8add..06a0657 100644 --- a/kernel/bpf/cgroup.c +++ b/kernel/bpf/cgroup.c @@ -180,8 +180,8 @@ static void activate_effective_progs(struct cgroup *cgrp, enum bpf_attach_type type, struct bpf_prog_array *old_array) { - rcu_swap_protected(cgrp->bpf.effective[type], old_array, - lockdep_is_held(&cgroup_mutex)); + old_array = rcu_replace(cgrp->bpf.effective[type], old_array, + lockdep_is_held(&cgroup_mutex)); /* free prog array after grace period, since __cgroup_bpf_run_*() * might be still walking the array */ -- 2.9.5