From: Jakub Kicinski <kuba@kernel.org>
To: Pavel Begunkov <asml.silence@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>,
netdev@vger.kernel.org, davem@davemloft.net, dsahern@kernel.org,
pabeni@redhat.com
Subject: Re: [PATCH v2] net: cache for same cpu skb_attempt_defer_free
Date: Tue, 13 Feb 2024 19:13:41 -0800 [thread overview]
Message-ID: <20240213191341.3370a443@kernel.org> (raw)
In-Reply-To: <457b4869-8f35-4619-8807-f79fc0122313@gmail.com>
On Tue, 13 Feb 2024 14:07:24 +0000 Pavel Begunkov wrote:
> >> + local_bh_disable();
> >> + skb_release_all(skb, SKB_DROP_REASON_NOT_SPECIFIED, false);
> >
> > I am trying to understand why we use false instead of true here ?
> > Or if you prefer:
> > local_bh_disable();
> > __napi_kfree_skb(skb, SKB_DROP_REASON_NOT_SPECIFIED);
> > local_bh_enable();
FWIW I had the same reaction. napi_safe = false followed by
napi_skb_cache_put() looks sus. No argument that naming is bad,
not the first time it comes up :(
> Maybe it's my misunderstanding but disabled bh != "napi safe",
> e.g. the napi_struct we're interested in might be scheduled for
> another CPU. Which is also why "napi" prefix in percpu
> napi_alloc_cache sounds a bit misleading to me.
FWIW the skb recycling is called napi_* to hint to driver authors that
if they are in NAPI context this is a better function to call.
The connection to a particular NAPI instance matters only for the page
pool recycling, but that's handled. The conditions you actually
need to look out for are hardware IRQs and whatever async paths which
can trigger trigger while NAPI is half way thru touching the cache of
the local CPU.
> The second reason is that it shouldn't change anything
> performance wise
>
> napi_pp_put_page(napi_safe) {
> ...
> if (napi_safe || in_softirq()) { ... }
> }
next prev parent reply other threads:[~2024-02-14 3:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-13 13:33 [PATCH v2] net: cache for same cpu skb_attempt_defer_free Pavel Begunkov
2024-02-13 13:53 ` Eric Dumazet
2024-02-13 14:07 ` Pavel Begunkov
2024-02-13 14:28 ` Eric Dumazet
2024-02-14 3:13 ` Jakub Kicinski [this message]
2024-02-14 16:37 ` Pavel Begunkov
2024-02-14 16:49 ` Jakub Kicinski
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=20240213191341.3370a443@kernel.org \
--to=kuba@kernel.org \
--cc=asml.silence@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).