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 X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E130C433E0 for ; Sat, 13 Feb 2021 20:21:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F282764DC3 for ; Sat, 13 Feb 2021 20:21:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229691AbhBMUVj (ORCPT ); Sat, 13 Feb 2021 15:21:39 -0500 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:47709 "EHLO wout3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229647AbhBMUVc (ORCPT ); Sat, 13 Feb 2021 15:21:32 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 03E58861; Sat, 13 Feb 2021 15:20:45 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sat, 13 Feb 2021 15:20:46 -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=fm2; bh=U/wNCY Y4gpjYy3HhOhHvq9GWD2lNQA40WnnSEne7ZY8=; b=v+wiXkKMPtd0ZMlvL9ICvQ hJDC6BZ5vC4GxwB57rizrSBtJyjwUq0Oa2d9g4PBna5BGUxVrBOaRH0L8EuyfGvw FpGzuIFLcKM9qwenhIc1B0hUtBLXuwvW7X1DZ1fXUu5imTmy2l+rLjqEamYzYQ/x RBa7epMnOZ5AtW0oK7bTmhgkCuDEZGQbjs46HEN9qGkNefnatcNHOqmDiuqCHY2c nwN9rZYw/mavseR1RoIcB4zds4hJVYYu1McIJgqRwTH5suaECepaFQ9xRwN3PJ4Y twskMdvAH8yHowQBSlON/pFGJo61yLRGVFr9CYTuSA1+QC8Z9JzeFLfMXHmJivvA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrieefgddufeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefkughoucfu tghhihhmmhgvlhcuoehiughoshgthhesihguohhstghhrdhorhhgqeenucggtffrrghtth gvrhhnpedtffekkeefudffveegueejffejhfetgfeuuefgvedtieehudeuueekhfduheel teenucfkphepkeegrddvvdelrdduheefrdeggeenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehiughoshgthhesihguohhstghhrdhorhhg X-ME-Proxy: Received: from localhost (igld-84-229-153-44.inter.net.il [84.229.153.44]) by mail.messagingengine.com (Postfix) with ESMTPA id D95ED24005C; Sat, 13 Feb 2021 15:20:44 -0500 (EST) Date: Sat, 13 Feb 2021 22:20:39 +0200 From: Ido Schimmel To: David Ahern Cc: Petr Machata , netdev@vger.kernel.org, David Ahern , "David S. Miller" , Jakub Kicinski , Ido Schimmel Subject: Re: [RFC PATCH 04/13] nexthop: Add implementation of resilient next-hop groups Message-ID: <20210213202039.GC401513@shredder.lan> References: 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 Sat, Feb 13, 2021 at 12:38:47PM -0700, David Ahern wrote: > On 2/8/21 1:42 PM, Petr Machata wrote: > > diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c > > index 5d560d381070..4ce282b0a65f 100644 > > --- a/net/ipv4/nexthop.c > > +++ b/net/ipv4/nexthop.c> @@ -734,6 +834,22 @@ static struct nexthop > *nexthop_select_path_mp(struct nh_group *nhg, int hash) > > return rc; > > } > > > > +static struct nexthop *nexthop_select_path_res(struct nh_group *nhg, int hash) > > +{ > > + struct nh_res_table *res_table = rcu_dereference(nhg->res_table); > > + u32 bucket_index = hash % res_table->num_nh_buckets; > > Have you considered requiring the number of buckets to be a power of 2 > to avoid the modulo in the hot path? Seems like those are the more > likely size options. We thought about it, but I think it is overly limiting. Even in Spectrum (for some sizes) it does not have to be a power of 2.