Subject: Re: [PATCH net-next v3 7/7] net: piggy back on the memory barrier in bql when waking queues

From: Jakub Kicinski <[email-masked]>
Date: Wed, 12 Apr 2023 06:54:08 -0700

On Wed, 12 Apr 2023 14:06:34 +0800 Herbert Xu wrote:
> On Thu, Apr 06, 2023 at 05:41:40PM -0700, Jakub Kicinski wrote:
> > I wanted to keep the same semantics as netdev_tx_completed_queue()
> > which only barriers if (bytes). Not in the least to make it obvious
> > to someone looking at the code of netdev_txq_completed_mb() (and not
> > the comment above it) that it doesn't _always_ put a barrier in.  
> 
> OK, but I think we should instead change netdev_tx_compelted_queue
> to do the smp_mb unconditionally.  We should never optimise for the
> unlikely case, and it is extremely unlikely for a TX cleanup routine
> to wind up with nothing to do.

I don't understand what you're trying to argue. The whole point of 
the patch is to use the BQL barrier and BQL returns early, before 
the barrier.

I don't think many people actually build kernels with BQL=n so the other
branch is more *documentation* than it is relevant, executed code.