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: Thu, 6 Apr 2023 17:41:40 -0700

On Thu, 6 Apr 2023 15:35:49 +0800 Herbert Xu wrote:
> Minor nit, I would write this as
> 
> 	if (IS_ENABLED(CONFIG_BQL))
> 		netdev_tx_completed_queue(dev_queue, pkts, bytes);
> 	else if (bytes)
> 		smp_mb();

Will do!

> Actually, why is this checking bytes while the caller is checking
> pkts? Do we need to check them at all? If pkts/bytes is commonly
> non-zero, then we should just do a barrier unconditionally and make
> the uncommon path pay the penalty.

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.