netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@google.com>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>,
	Neal Cardwell <ncardwell@google.com>,
	 David Ahern <dsahern@kernel.org>,
	Simon Horman <horms@kernel.org>,
	 Kuniyuki Iwashima <kuni1840@gmail.com>,
	netdev@vger.kernel.org,  Kuniyuki Iwashima <kuniyu@amazon.com>
Subject: Re: [PATCH v1 net-next 2/7] tcp: Save __module_get() for TIME_WAIT sockets.
Date: Thu, 21 Aug 2025 10:16:26 -0700	[thread overview]
Message-ID: <CAAVpQUC1yEB-VqKr0qPCmGEKHkfSyGt-bZn7bdEgCHe6c3FH+g@mail.gmail.com> (raw)
In-Reply-To: <CANn89iL+D-OcDgxWYVP4vufeuOESrz=jy-wknM=Bbb7qVZoJuw@mail.gmail.com>

On Wed, Aug 20, 2025 at 11:46 PM Eric Dumazet <edumazet@google.com> wrote:
>
> On Wed, Aug 20, 2025 at 11:16 PM Kuniyuki Iwashima <kuniyu@google.com> wrote:
> >
> > From: Kuniyuki Iwashima <kuniyu@amazon.com>
> >
> > __module_get() in inet_twsk_alloc() was necessary to prevent
> > unloading tw->tw_prot, which is used in inet_twsk_free().
> >
> > DCCP has gone, and TCP is built-in, so the pair is no longer needed.
> >
> > ULPs also do not need it because
> >
> >  * kTLS and XFRM_ESPINTCP restore sk_prot before close()
> >  * MPTCP is built-in
> >  * SMC uses TCP as is
> >
> > , but using tw_prot without module_get() would be error prone to
> > future ULP addition.
> >
> > Now we can use kfree() without the slab cache pointer thanks to SLUB.
>
> Right, but kmem_cache_free() has extra debug checks (SLAB_CONSISTENCY_CHECKS):
> we check the object was indeed allocated from a precise cache.
>
> I would prefer leaving this in place.
>
> Such a conversion could be done globally if you think about it, no
> need for hundreds of patches.
>
> static inline void kmem_cache_free(struct kmem_cache *s, void *x)
> {
>       kfree(x);
> }
>
>
> >
> > Let's use kfree() in inet_twsk_free() and remove 2 atomic ops
> > for each connection.
> >
>
> Where are you seeing the atomic ops exactly ?
>
> TCP is builtin, so .owner is NULL.

Ah exactly, I think I was confused with DCCP.
I'll drop this patch in v2.

Thanks!

  reply	other threads:[~2025-08-21 17:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-21  6:15 [PATCH v1 net-next 0/7] tcp: Follow up for DCCP removal Kuniyuki Iwashima
2025-08-21  6:15 ` [PATCH v1 net-next 1/7] tcp: Remove sk_protocol test for tcp_twsk_unique() Kuniyuki Iwashima
2025-08-21  6:27   ` Eric Dumazet
2025-08-21  6:50   ` Eric Dumazet
2025-08-21 17:21     ` Kuniyuki Iwashima
2025-08-21  6:15 ` [PATCH v1 net-next 2/7] tcp: Save __module_get() for TIME_WAIT sockets Kuniyuki Iwashima
2025-08-21  6:46   ` Eric Dumazet
2025-08-21 17:16     ` Kuniyuki Iwashima [this message]
2025-08-21  6:15 ` [PATCH v1 net-next 3/7] tcp: Remove timewait_sock_ops.twsk_destructor() Kuniyuki Iwashima
2025-08-21  6:53   ` Eric Dumazet
2025-08-21  6:15 ` [PATCH v1 net-next 4/7] tcp: Remove hashinfo test for inet6?_lookup_run_sk_lookup() Kuniyuki Iwashima
2025-08-21  7:00   ` Eric Dumazet
2025-08-21  6:15 ` [PATCH v1 net-next 5/7] tcp: Don't pass hashinfo to socket lookup helpers Kuniyuki Iwashima
2025-08-21  6:15 ` [PATCH v1 net-next 6/7] tcp: Don't pass hashinfo to inet_diag helpers Kuniyuki Iwashima
2025-08-21  6:15 ` [PATCH v1 net-next 7/7] tcp: Move TCP-specific diag functions to tcp_diag.c Kuniyuki Iwashima

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=CAAVpQUC1yEB-VqKr0qPCmGEKHkfSyGt-bZn7bdEgCHe6c3FH+g@mail.gmail.com \
    --to=kuniyu@google.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuni1840@gmail.com \
    --cc=kuniyu@amazon.com \
    --cc=ncardwell@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).