[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b9a8fc9e-4e0c-7e7c-0b8a-da520c9dd837@gmail.com>
Date: Sat, 13 Feb 2021 12:38:47 -0700
From: David Ahern <dsahern@...il.com>
To: Petr Machata <petrm@...dia.com>, netdev@...r.kernel.org
Cc: David Ahern <dsahern@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Ido Schimmel <idosch@...dia.com>
Subject: Re: [RFC PATCH 04/13] nexthop: Add implementation of resilient
next-hop groups
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.
Powered by blists - more mailing lists