From: Sabrina Dubroca <sd@queasysnail.net>
To: Eric Dumazet <edumazet@google.com>
Cc: "Hudson, Nick" <nhudson@akamai.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: skb_attempt_defer_free and reference counting
Date: Tue, 4 Nov 2025 15:43:02 +0100 [thread overview]
Message-ID: <aQoQ9pEKia_8Uuzi@krikkit> (raw)
In-Reply-To: <CANn89iJQ_Hx_T7N6LPr2Qt-_O2KZ3GPgWFtywJBvjjTQvGwy2Q@mail.gmail.com>
2025-10-31, 04:43:19 -0700, Eric Dumazet wrote:
> On Fri, Oct 31, 2025 at 4:04 AM Hudson, Nick <nhudson@akamai.com> wrote:
> >
> > Hi,
> >
> > I’ve been looking at using skb_attempt_defer_free and had a question about the skb reference counting.
> >
> > The existing reference release for any skb handed to skb_attempt_defer_free is done in skb_defer_free_flush (via napi_consume_skb). However, it seems to me that calling skb_attempt_defer_free on the same skb to drop the multiple references is problematic as, if the defer_list isn’t serviced between the calls, the list gets corrupted. That is, the skb can’t appear on the list twice.
> >
> > Would it be possible to move the reference count drop into skb_attempt_defer_free and only add the skb to the list on last reference drop?
>
> We do not plan using this helper for arbitrary skbs, but ones fully
> owned by TCP and UDP receive paths.
>
> skb_share_check() must have been called before reaching them.
Do you think it's worth adding another DEBUG_NET_WARN_ON_ONCE check to
skb_attempt_defer_free(), to validate (and in a way, document) that
assumption?
--
Sabrina
next prev parent reply other threads:[~2025-11-04 14:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-31 11:04 skb_attempt_defer_free and reference counting Hudson, Nick
2025-10-31 11:43 ` Eric Dumazet
2025-10-31 14:02 ` Hudson, Nick
2025-11-04 12:44 ` Other use cases for skb_attempt_defer_free [was Re: skb_attempt_defer_free and reference counting] Hudson, Nick
2025-11-04 14:43 ` Sabrina Dubroca [this message]
2025-11-04 15:04 ` skb_attempt_defer_free and reference counting Eric Dumazet
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=aQoQ9pEKia_8Uuzi@krikkit \
--to=sd@queasysnail.net \
--cc=edumazet@google.com \
--cc=netdev@vger.kernel.org \
--cc=nhudson@akamai.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