From: Breno Leitao <leitao@debian.org>
To: Paolo Abeni <pabeni@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
leit@meta.com, Chris Mason <clm@fb.com>,
"open list:NETWORKING DRIVERS" <netdev@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next] net: skbuff: Skip early return in skb_unref when debugging
Date: Tue, 30 Jul 2024 03:24:08 -0700 [thread overview]
Message-ID: <Zqi/SL/icYA9IwjH@gmail.com> (raw)
In-Reply-To: <e6b1f967-aaf4-47f4-be33-c981a7abc120@redhat.com>
Hello Paolo,
On Tue, Jul 30, 2024 at 11:38:38AM +0200, Paolo Abeni wrote:
> On 7/29/24 12:47, Breno Leitao wrote:
> > --- a/include/linux/skbuff.h
> > +++ b/include/linux/skbuff.h
> > @@ -1225,7 +1225,7 @@ static inline bool skb_unref(struct sk_buff *skb)
> > {
> > if (unlikely(!skb))
> > return false;
> > - if (likely(refcount_read(&skb->users) == 1))
> > + if (!IS_ENABLED(CONFIG_DEBUG_NET) && likely(refcount_read(&skb->users) == 1))
> > smp_rmb();
> > else if (likely(!refcount_dec_and_test(&skb->users)))
> > return false;
> I think one assumption behind CONFIG_DEBUG_NET is that enabling such config
> should not have any measurable impact on performances.
>
> I suspect the above could indeed cause some measurable impact, e.g. under
> UDP flood, when the user-space receiver and the BH runs on different cores,
> as this will increase pressure on the CPU cache. Could you please benchmark
> such scenario before and after this patch?
Sure, I am more than happy to do so. I will be back with it soon.
Assuming there is some performance overhead, isn't it a worthwhile
trade-off for those who are debugging the network? In other words,
wouldn't it be better to prioritize correctness over optimization in
this the CONFIG_DEBUG_NET case, even if it means sacrificing some
performance?
Thanks for reviewing,
--breno
next prev parent reply other threads:[~2024-07-30 10:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-29 10:47 [PATCH net-next] net: skbuff: Skip early return in skb_unref when debugging Breno Leitao
2024-07-30 9:38 ` Paolo Abeni
2024-07-30 10:24 ` Breno Leitao [this message]
2024-07-30 10:50 ` Florian Westphal
2024-07-30 11:15 ` Paolo Abeni
2024-07-30 14:10 ` Jakub Kicinski
2024-07-30 14:21 ` Eric Dumazet
2024-07-30 14:37 ` Paolo Abeni
2024-07-30 14:48 ` Jakub Kicinski
2024-07-31 11:24 ` Breno Leitao
2024-07-31 11:53 ` Jason Xing
2024-08-01 9:07 ` Paolo Abeni
2024-08-01 9:30 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zqi/SL/icYA9IwjH@gmail.com \
--to=leitao@debian.org \
--cc=clm@fb.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=leit@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.