[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANn89iJaUgXMApeS-+Tbq4-48dOUESmpzEMW21mGkQi-0CahpA@mail.gmail.com>
Date: Tue, 4 Nov 2025 07:04:52 -0800
From: Eric Dumazet <edumazet@...gle.com>
To: Sabrina Dubroca <sd@...asysnail.net>
Cc: "Hudson, Nick" <nhudson@...mai.com>, "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: skb_attempt_defer_free and reference counting
On Tue, Nov 4, 2025 at 6:43 AM Sabrina Dubroca <sd@...asysnail.net> wrote:
>
> 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?
Let's see first if Nick Hudson proposes a working patch, with some numbers...
Powered by blists - more mailing lists