From: Tony Battersby <tonyb@cybernetics.com>
To: Eric Dumazet <edumazet@google.com>
Cc: netdev@vger.kernel.org, "Simon Horman" <horms@kernel.org>,
"Kuniyuki Iwashima" <kuniyu@google.com>,
"Willem de Bruijn" <willemb@google.com>,
eric.dumazet@gmail.com, "David S . Miller" <davem@davemloft.net>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Toke Høiland-Jørgensen" <toke@redhat.com>,
"Jason Xing" <kerneljasonxing@gmail.com>
Subject: Re: Long delay in freeing skbs
Date: Mon, 9 Mar 2026 17:18:35 -0400 [thread overview]
Message-ID: <cb925a24-c4a2-46cd-98e8-2be5e2aa2152@cybernetics.com> (raw)
In-Reply-To: <CANn89iJziPq9Au9A8DK8Um6Nn2F-xTcG3+r5x0tVMf+7TUJEMg@mail.gmail.com>
On 3/9/26 17:07, Eric Dumazet wrote:
> On Mon, Mar 9, 2026 at 10:00 PM Tony Battersby <tonyb@cybernetics.com> wrote:
>> I have some out-of-tree code that was broken by commit e20dfbad8aab
>> ("net: fix napi_consume_skb() with alien skbs") in kernel 6.19. I
>> retested with 7.0-rc3 with the same results. I'm not sure if the change
>> in behavior that I am seeing is expected or if it is a bug, so I thought
>> I would ask. Omitting irrelevant details, my kernel code does the
>> following:
>>
>> 1) allocate a buffer
>> 2) perform some network I/O using the buffer (cmd over iscsi_tcp)
>> 3) wait for the I/O to complete
>> 4) wait for the buffer page refcounts to drop back to their values for
>> idle I/O
>> 5) reuse the buffer for more I/O
>>
>> Step 4 is necessary in this case due to some of those irrelevant details
>> that I omitted, and that is where it trips up. Commit e20dfbad8aab
>> seems to keep the page refcounts elevated long after the I/O has
>> completed (hours or longer), presumably because the deferred skb free
>> isn't happening for a long time. So:
>>
>> 1) Is this long delay expected, or is this a bug?
>>
>> 2) If the delay is expected, is there a way for me to force the network
>> system to process the deferred skb frees on request? e.g. write to a
>> file in /sys, or call a kernel function to flush the deferred frees?
>>
>> Worst case is that I can redesign my code to kfree() the buffer if it is
>> busy and allocate a new one, and let the old buffer be freed
>> asynchronously when the skb is freed at some indeterminate time in the
>> future.
>>
>> Thanks,
>> Tony Battersby
>
> If you are using zero copy, please look at:
>
> Maybe you should make sure your code is compatible with it.
>
> commit 0943404b1f3b178e1e54386dadcbf4f2729c7762
> Author: Eric Dumazet <edumazet@google.com>
> Date: Mon Feb 16 19:36:53 2026 +0000
>
> net: do not delay zero-copy skbs in skb_attempt_defer_free()
>
> After the blamed commit, TCP tx zero copy notifications could be
> arbitrarily delayed and cause regressions in applications waiting
> for them.
>
The I/O is being sent by a userspace program via the SCSI generic driver
(drivers/scsi/sg.c) over iSCSI (drivers/scsi/iscsi_tcp.c). I don't see
any mention of zero copy in iscsi_tcp.c.
Tony
next prev parent reply other threads:[~2026-03-09 21:34 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-06 20:29 [PATCH net-next 0/3] net: use skb_attempt_defer_free() in napi_consume_skb() Eric Dumazet
2025-11-06 20:29 ` [PATCH net-next 1/3] net: allow skb_release_head_state() to be called multiple times Eric Dumazet
2025-11-07 6:42 ` Kuniyuki Iwashima
2025-11-07 11:23 ` Toke Høiland-Jørgensen
2025-11-06 20:29 ` [PATCH net-next 2/3] net: fix napi_consume_skb() with alien skbs Eric Dumazet
2025-11-07 6:46 ` Kuniyuki Iwashima
2025-11-07 11:23 ` Toke Høiland-Jørgensen
2025-11-07 12:28 ` Eric Dumazet
2025-11-07 14:34 ` Toke Høiland-Jørgensen
2025-11-07 15:44 ` Jason Xing
2025-11-11 16:56 ` Aditya Garg
2025-11-11 17:17 ` Eric Dumazet
2025-11-12 5:14 ` Aditya Garg
2025-11-12 14:03 ` Jon Hunter
2025-11-12 14:08 ` Eric Dumazet
2025-11-12 15:26 ` Jon Hunter
2025-11-12 15:32 ` Eric Dumazet
2026-03-09 21:00 ` Long delay in freeing skbs Tony Battersby
2026-03-09 21:07 ` Eric Dumazet
2026-03-09 21:18 ` Tony Battersby [this message]
2026-03-09 21:24 ` Eric Dumazet
2026-03-09 21:47 ` Tony Battersby
2026-03-10 14:49 ` Tony Battersby
2026-03-10 15:25 ` Eric Dumazet
2025-11-06 20:29 ` [PATCH net-next 3/3] net: increase skb_defer_max default to 128 Eric Dumazet
2025-11-07 6:47 ` Kuniyuki Iwashima
2025-11-07 11:23 ` Toke Høiland-Jørgensen
2025-11-07 15:37 ` Jason Xing
2025-11-07 15:47 ` Eric Dumazet
2025-11-07 15:49 ` Jason Xing
2025-11-07 16:00 ` Eric Dumazet
2025-11-07 16:03 ` Jason Xing
2025-11-07 16:08 ` Eric Dumazet
2025-11-07 16:20 ` Jason Xing
2025-11-07 16:26 ` Eric Dumazet
2025-11-07 16:59 ` Jason Xing
2025-11-08 3:10 ` [PATCH net-next 0/3] net: use skb_attempt_defer_free() in napi_consume_skb() 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=cb925a24-c4a2-46cd-98e8-2be5e2aa2152@cybernetics.com \
--to=tonyb@cybernetics.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=horms@kernel.org \
--cc=kerneljasonxing@gmail.com \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=toke@redhat.com \
--cc=willemb@google.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.