[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aQoQ9pEKia_8Uuzi@krikkit>
Date: Tue, 4 Nov 2025 15:43:02 +0100
From: Sabrina Dubroca <sd@...asysnail.net>
To: Eric Dumazet <edumazet@...gle.com>
Cc: "Hudson, Nick" <nhudson@...mai.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: skb_attempt_defer_free and reference counting
2025-10-31, 04:43:19 -0700, Eric Dumazet wrote:
> On Fri, Oct 31, 2025 at 4:04 AM Hudson, Nick <nhudson@...mai.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
Powered by blists - more mailing lists