Re: [PATCH net v3 2/2] bonding: fix u32 overflow in compute_gap()
From: Hangbin Liu
Date: Tue Aug 18 2026 - 22:10:19 EST
On Wed, Aug 19, 2026 at 10:07:22AM +0800, Hangbin Liu wrote:
> > > > ... this here, as u64_stats_update_begin doesn't provide exclusive access, so writers
> > > > must do that themselves, so you can't be sure what value will end up, the zeroing
> > > > might not work at all and can get overwritten
> > > >
> > >
> > > I meant - it doesn't improve on the current situation where it can also happen. :)
>
> Ah, yes. I forgot this. The reset_unbalanced_load() could be called on any
> CPU, which conflicts with other writers.
>
> I re-checked the code. unbalanced_load is only called in two situations:
> 1. To rebalance the load in bond_alb_monitor(), which only executes once
> every 10 seconds.
> 2. !tx_slave in bond_do_alb_xmit(), which is only for multicast/broadcast
> traffic. This traffic shouldn't be significant.
>
> So looks using spin_lock here is acceptable. What do you think?
I mean, drop the per-CPU design directly and use spin_lock to protect the data.
Hangbin