On 14 Mar 2025, at 21:00, Vladislav Odintsov wrote:

> With this commit the rebalance of hash entries between bonding members
> becomes less frequent.  If we know all bond members' speed, we do not
> move hash entries between them if load difference is less than 1.5% of
> minimum link speed of bond members.
>
> Reported-at: 
> https://mail.openvswitch.org/pipermail/ovs-dev/2025-March/422028.html
> Suggested-by: Ilya Maximets <i.maxim...@ovn.org>
> Signed-off-by: Vladislav Odintsov <vlodintsov@k2.cloud>

Not a review, but I noticed you did not update the related documentation.

//Eelco

> ---
>  ofproto/bond.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/ofproto/bond.c b/ofproto/bond.c
> index 17bf10be5..70219db89 100644
> --- a/ofproto/bond.c
> +++ b/ofproto/bond.c
> @@ -1336,6 +1336,7 @@ bond_rebalance(struct bond *bond)
>      struct ovs_list bals;
>      bool rebalanced = false;
>      bool use_recirc;
> +    uint32_t min_member_mbps = UINT32_MAX;
>
>      ovs_rwlock_wrlock(&rwlock);
>      if (!bond_is_balanced(bond) || time_msec() < bond->next_rebalance) {
> @@ -1378,7 +1379,11 @@ bond_rebalance(struct bond *bond)
>      ovs_list_init(&bals);
>      HMAP_FOR_EACH (member, hmap_node, &bond->members) {
>          if (member->enabled) {
> +            uint32_t mbps;
> +
>              insert_bal(&bals, member);
> +            netdev_get_speed(member->netdev, &mbps, NULL);
> +            min_member_mbps = MIN(mbps, min_member_mbps);
>          }
>      }
>      log_bals(bond, &bals);
> @@ -1392,10 +1397,12 @@ bond_rebalance(struct bond *bond)
>          uint64_t overload;
>
>          overload = from->tx_bytes - to->tx_bytes;
> -        if (overload < to->tx_bytes >> 5 || overload < 100000) {
> +        if (overload < to->tx_bytes >> 5 ||
> +            overload / 1000000 < MAX(1, min_member_mbps / 8 >> 6)) {
>              /* The extra load on 'from' (and all less-loaded members), 
> compared
>               * to that of 'to' (the least-loaded member), is less than ~3%, 
> or
> -             * it is less than ~1Mbps.  No point in rebalancing. */
> +             * it is less than MAX of 1MB and ~1.5% of minimum bond member
> +             * link speed, if present.  No point in rebalancing. */
>              break;
>          }
>
> -- 
> 2.48.1
>
> _______________________________________________
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to