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.

Reply via email to