From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <eric.dumazet@gmail.com>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<kuni1840@gmail.com>, <kuniyu@amazon.com>,
<netdev@vger.kernel.org>, <pabeni@redhat.com>
Subject: Re: [PATCH v5 net-next 6/6] tcp: Introduce optional per-netns ehash.
Date: Wed, 7 Sep 2022 17:02:06 -0700 [thread overview]
Message-ID: <20220908000206.41237-1-kuniyu@amazon.com> (raw)
In-Reply-To: <8c70c1f8-68df-a9cb-9bba-f26edaebd4a6@gmail.com>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 7 Sep 2022 16:45:17 -0700
> On 9/6/22 17:55, Kuniyuki Iwashima wrote:
> > The more sockets we have in the hash table, the longer we spend looking
> > up the socket. While running a number of small workloads on the same
> > host, they penalise each other and cause performance degradation.
> >
> >
> > +
> > +struct inet_hashinfo *inet_pernet_hashinfo_alloc(struct inet_hashinfo *hashinfo,
> > + unsigned int ehash_entries)
> > +{
> > + struct inet_hashinfo *new_hashinfo;
> > + int i;
> > +
> > + new_hashinfo = kmalloc(sizeof(*new_hashinfo), GFP_KERNEL);
>
> You probably could use kmemdup(hashinfo, sizeof(*hashinfo), GFP_KERNEL);
Exactly, I'll use it and remove the manual copy.
Thank you!
> > + if (!new_hashinfo)
> > + goto err;
> > +
> > + new_hashinfo->ehash = kvmalloc_array(ehash_entries,
> > + sizeof(struct inet_ehash_bucket),
> > + GFP_KERNEL_ACCOUNT);
> > + if (!new_hashinfo->ehash)
> > + goto free_hashinfo;
> > +
> > + new_hashinfo->ehash_mask = ehash_entries - 1;
> > +
> > + if (inet_ehash_locks_alloc(new_hashinfo))
> > + goto free_ehash;
> > +
> > + for (i = 0; i < ehash_entries; i++)
> > + INIT_HLIST_NULLS_HEAD(&new_hashinfo->ehash[i].chain, i);
> > +
> > + new_hashinfo->bind_bucket_cachep = hashinfo->bind_bucket_cachep;
> > + new_hashinfo->bhash = hashinfo->bhash;
> > + new_hashinfo->bind2_bucket_cachep = hashinfo->bind2_bucket_cachep;
> > + new_hashinfo->bhash2 = hashinfo->bhash2;
> > + new_hashinfo->bhash_size = hashinfo->bhash_size;
> > +
> > + new_hashinfo->lhash2_mask = hashinfo->lhash2_mask;
> > + new_hashinfo->lhash2 = hashinfo->lhash2;
>
>
> This would avoid copying all these @hashinfo fields.
prev parent reply other threads:[~2022-09-08 0:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-07 0:55 [PATCH v5 net-next 0/6] tcp: Introduce optional per-netns ehash Kuniyuki Iwashima
2022-09-07 0:55 ` [PATCH v5 net-next 1/6] tcp: Clean up some functions Kuniyuki Iwashima
2022-09-07 0:55 ` [PATCH v5 net-next 2/6] tcp: Don't allocate tcp_death_row outside of struct netns_ipv4 Kuniyuki Iwashima
2022-09-07 0:55 ` [PATCH v5 net-next 3/6] tcp: Set NULL to sk->sk_prot->h.hashinfo Kuniyuki Iwashima
2022-09-07 0:55 ` [PATCH v5 net-next 4/6] tcp: Access &tcp_hashinfo via net Kuniyuki Iwashima
2022-09-07 0:55 ` [PATCH v5 net-next 5/6] tcp: Save unnecessary inet_twsk_purge() calls Kuniyuki Iwashima
2022-09-07 0:55 ` [PATCH v5 net-next 6/6] tcp: Introduce optional per-netns ehash Kuniyuki Iwashima
2022-09-07 20:55 ` Eric Dumazet
2022-09-07 21:46 ` Kuniyuki Iwashima
2022-09-07 21:57 ` Eric Dumazet
2022-09-07 22:43 ` Kuniyuki Iwashima
2022-09-07 23:45 ` Eric Dumazet
2022-09-08 0:02 ` Kuniyuki Iwashima [this message]
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=20220908000206.41237-1-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=kuba@kernel.org \
--cc=kuni1840@gmail.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).