Re: [PATCH net v5 1/2] bonding: convert unbalanced_load to per-cpu state

From: Nikolay Aleksandrov

Date: Wed Aug 26 2026 - 03:34:32 EST


On 25/08/2026 04:01, Hangbin Liu wrote:
From: Hangbin Liu <liuhangbin@xxxxxxxxxx>

A later patch widens the bonding TLB tx counters from u32 to u64. The
unbalanced_load counter sits in the transmit hot path, and cross-CPU
synchronization of a u64 would introduce measurable overhead. Convert
unbalanced_load to a per-cpu counter first so that the subsequent
widening only touches per-cpu data local to each CPU.

Introduce struct unbalanced_load_stats to hold the per-cpu counter,
and move the aggregation into a helper, reset_unbalanced_load(), which
sums all per-cpu instances. Use the delta of current total load vs
variable prev_total_unbalanced to calculate the loading.

Signed-off-by: Hangbin Liu <liuhangbin@xxxxxxxxxx>
---
drivers/net/bonding/bond_alb.c | 37 ++++++++++++++++++++++++++++++-------
include/net/bond_alb.h | 7 ++++++-
2 files changed, 36 insertions(+), 8 deletions(-)


Reviewed-by: Nikolay Aleksandrov <razor@xxxxxxxxxxxxx>