From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 686A3C433EF for ; Sun, 21 Nov 2021 17:35:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238287AbhKURi0 (ORCPT ); Sun, 21 Nov 2021 12:38:26 -0500 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:60895 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231519AbhKURi0 (ORCPT ); Sun, 21 Nov 2021 12:38:26 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id D71AD5C0178; Sun, 21 Nov 2021 12:35:20 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sun, 21 Nov 2021 12:35:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=nwrzCy LhAuB9F8Gt2/NiQNrd4xBbwZ48U7MNTLuRTts=; b=Jgsvd17xbB6u4tM76YwwXx KhvbKy4/hov2mLVO125TC9ViD9O2+tXbcil4iaCR7mSwl4QByG2pqPi/IEQpyz2w o0iS4jTxn5fXTsAIJBzH4NajeXZ6XCyivCl+vZDUkXX+ISVNAHhVfbjewN7OFH+G TxNVN6h+xhjgitFiPeE+iSi9v2NFz1ynNc2mOD/6hl8uFnqpAE2sZjtHGh+ZMI5+ DvHYD5+nmfD0qR8Dmf9rchwAekrKcoOqTgoaV/KjgGQJ6v0HZb1ymYXKWFSG9iqh jkFOk95iu/RnTTk02KcfMaYTy5hDtoO5EGRD3c/Pov6fxj3h6O+L/9R9FghpsQ7Q == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrgedvgddutdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdortddttddvnecuhfhrohhmpefkughoucfu tghhihhmmhgvlhcuoehiughoshgthhesihguohhstghhrdhorhhgqeenucggtffrrghtth gvrhhnpefgjeevhfdvgeeiudekteduveegueejfefffeefteekkeeuueehjeduledtjeeu udenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehiug hoshgthhesihguohhstghhrdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 21 Nov 2021 12:35:19 -0500 (EST) Date: Sun, 21 Nov 2021 19:35:17 +0200 From: Ido Schimmel To: Nikolay Aleksandrov Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org, dsahern@gmail.com, Nikolay Aleksandrov Subject: Re: [PATCH net 2/3] net: nexthop: release IPv6 per-cpu dsts when replacing a nexthop group Message-ID: References: <20211121152453.2580051-1-razor@blackwall.org> <20211121152453.2580051-3-razor@blackwall.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Sun, Nov 21, 2021 at 07:17:41PM +0200, Ido Schimmel wrote: > On Sun, Nov 21, 2021 at 05:24:52PM +0200, Nikolay Aleksandrov wrote: > > From: Nikolay Aleksandrov > Can we avoid two synchronize_net() per resilient group by removing the > one added here and instead do: > > diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c > index a69a9e76f99f..a47ce43ab1ff 100644 > --- a/net/ipv4/nexthop.c > +++ b/net/ipv4/nexthop.c > @@ -2002,9 +2002,10 @@ static int replace_nexthop_grp(struct net *net, struct nexthop *old, > > rcu_assign_pointer(old->nh_grp, newg); > > + /* Make sure concurrent readers are not using 'oldg' anymore. */ > + synchronize_net(); > + > if (newg->resilient) { > - /* Make sure concurrent readers are not using 'oldg' anymore. */ > - synchronize_net(); > rcu_assign_pointer(oldg->res_table, tmp_table); > rcu_assign_pointer(oldg->spare->res_table, tmp_table); > } Discussed this with Nik. It is possible and would be a good cleanup for net-next. For net it is best to leave synchronize_net() where it is so that the patch will be easier to backport. Resilient nexthop groups were only added in 5.13 whereas nexthop objects were added in 5.3