linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <edumazet@google.com>
Cc: <chuck.lever@oracle.com>, <davem@davemloft.net>,
	<jlayton@kernel.org>, <keescook@chromium.org>, <kuba@kernel.org>,
	<kuni1840@gmail.com>, <kuniyu@amazon.com>,
	<linux-fsdevel@vger.kernel.org>, <mcgrof@kernel.org>,
	<netdev@vger.kernel.org>, <pabeni@redhat.com>,
	<yzaikin@google.com>
Subject: Re: [PATCH v1 net-next 06/13] tcp: Set NULL to sk->sk_prot->h.hashinfo.
Date: Fri, 26 Aug 2022 10:26:23 -0700	[thread overview]
Message-ID: <20220826172623.97832-1-kuniyu@amazon.com> (raw)
In-Reply-To: <CANn89iK0FeokqWLPrWY8iger7iYXU5fJQyxaGbGecTe11+8p7A@mail.gmail.com>

From:   Eric Dumazet <edumazet@google.com>
Date:   Fri, 26 Aug 2022 08:40:49 -0700
> On Thu, Aug 25, 2022 at 5:07 PM Kuniyuki Iwashima <kuniyu@amazon.com> wrote:
> >
> > We will soon introduce an optional per-netns ehash.
> >
> > This means we cannot use the global sk->sk_prot->h.hashinfo
> > to fetch a TCP hashinfo.
> >
> > Instead, set NULL to sk->sk_prot->h.hashinfo for TCP and get
> > a proper hashinfo from net->ipv4.tcp_death_row->hashinfo.
> >
> > Note that we need not use sk->sk_prot->h.hashinfo if DCCP is
> > disabled.
> >
> > Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
> > ---
> >  include/net/inet_hashtables.h   | 10 ++++++++++
> >  net/ipv4/af_inet.c              |  2 +-
> >  net/ipv4/inet_connection_sock.c |  6 +++---
> >  net/ipv4/inet_hashtables.c      | 14 +++++++-------
> >  net/ipv4/tcp_ipv4.c             |  2 +-
> >  net/ipv6/tcp_ipv6.c             |  2 +-
> >  6 files changed, 23 insertions(+), 13 deletions(-)
> >
> > diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
> > index 44a419b9e3d5..2c866112433e 100644
> > --- a/include/net/inet_hashtables.h
> > +++ b/include/net/inet_hashtables.h
> > @@ -170,6 +170,16 @@ struct inet_hashinfo {
> >         struct inet_listen_hashbucket   *lhash2;
> >  };
> >
> > +static inline struct inet_hashinfo *inet_get_hashinfo(const struct sock *sk)
> > +{
> > +#if IS_ENABLED(CONFIG_IP_DCCP)
> > +       return sk->sk_prot->h.hashinfo ? :
> > +               sock_net(sk)->ipv4.tcp_death_row->hashinfo;
> > +#else
> > +       return sock_net(sk)->ipv4.tcp_death_row->hashinfo;
> > +#endif
> > +}
> >
> 
> If the sk_prot->h.hashinfo must disappear, I would rather add a new
> inet->hashinfo field
> 
> return inet_sk(sk)->hashinfo
> 
> Conceptually, the pointer no longer belongs to sk_prot, and not in struct net,
> otherwise you should name this helper   tcp_or_dccp_get_hashinfo() to avoid
> any temptation to use it for other inet protocol.

That makes sense.

To keep the series simple, I'll use tcp_or_dccp_get_hashinfo() in v2 and
post follow-up patch to add inet_sk(sk)->hashinfo, which needs a little
bit more work/test I think.

Thank you!

  reply	other threads:[~2022-08-26 17:26 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-26  0:04 [PATCH v1 net-next 00/13] tcp/udp: Introduce optional per-netns hash table Kuniyuki Iwashima
2022-08-26  0:04 ` [PATCH v1 net-next 01/13] fs/lock: Revive LOCK_MAND Kuniyuki Iwashima
2022-08-26 10:02   ` Jeff Layton
2022-08-26 16:48     ` Kuniyuki Iwashima
2022-08-26  0:04 ` [PATCH v1 net-next 02/13] sysctl: Support LOCK_MAND for read/write Kuniyuki Iwashima
2022-08-26  0:04 ` [PATCH v1 net-next 03/13] selftest: sysctl: Add test for flock(LOCK_MAND) Kuniyuki Iwashima
2022-08-26  0:04 ` [PATCH v1 net-next 04/13] net: Introduce init2() for pernet_operations Kuniyuki Iwashima
2022-08-26 15:20   ` Eric Dumazet
2022-08-26 17:03     ` Kuniyuki Iwashima
2022-08-26  0:04 ` [PATCH v1 net-next 05/13] tcp: Clean up some functions Kuniyuki Iwashima
2022-08-26  0:04 ` [PATCH v1 net-next 06/13] tcp: Set NULL to sk->sk_prot->h.hashinfo Kuniyuki Iwashima
2022-08-26 15:40   ` Eric Dumazet
2022-08-26 17:26     ` Kuniyuki Iwashima [this message]
2022-08-26  0:04 ` [PATCH v1 net-next 07/13] tcp: Access &tcp_hashinfo via net Kuniyuki Iwashima
2022-08-26  0:04 ` [PATCH v1 net-next 08/13] tcp: Introduce optional per-netns ehash Kuniyuki Iwashima
2022-08-26 15:24   ` Eric Dumazet
2022-08-26 17:19     ` Kuniyuki Iwashima
2022-08-26  0:04 ` [PATCH v1 net-next 09/13] udp: Clean up some functions Kuniyuki Iwashima
2022-08-26  0:04 ` [PATCH v1 net-next 10/13] udp: Set NULL to sk->sk_prot->h.udp_table Kuniyuki Iwashima
2022-08-26  0:04 ` [PATCH v1 net-next 11/13] udp: Set NULL to udp_seq_afinfo.udp_table Kuniyuki Iwashima
2022-08-26  0:04 ` [PATCH v1 net-next 12/13] udp: Access &udp_table via net Kuniyuki Iwashima
2022-08-26  0:04 ` [PATCH v1 net-next 13/13] udp: Introduce optional per-netns hash table Kuniyuki Iwashima
2022-08-26 15:17 ` [PATCH v1 net-next 00/13] tcp/udp: " Eric Dumazet
2022-08-26 16:51   ` 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=20220826172623.97832-1-kuniyu@amazon.com \
    --to=kuniyu@amazon.com \
    --cc=chuck.lever@oracle.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jlayton@kernel.org \
    --cc=keescook@chromium.org \
    --cc=kuba@kernel.org \
    --cc=kuni1840@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=yzaikin@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 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).