From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <edumazet@google.com>
Cc: <davem@davemloft.net>, <kuba@kernel.org>, <kuni1840@gmail.com>,
<kuniyu@amazon.com>, <netdev@vger.kernel.org>,
<pabeni@redhat.com>
Subject: Re: [PATCH v2 net-next 5/5] tcp: Introduce optional per-netns ehash.
Date: Mon, 29 Aug 2022 16:18:12 -0700 [thread overview]
Message-ID: <20220829231812.19979-1-kuniyu@amazon.com> (raw)
In-Reply-To: <CANn89iJ55OHnWh88-pRxMt4d_4cbr5Fa+JOH2VDrT1SWq1t=ZA@mail.gmail.com>
From: Eric Dumazet <edumazet@google.com>
Date: Mon, 29 Aug 2022 15:59:04 -0700
> On Mon, Aug 29, 2022 at 9:21 AM Kuniyuki Iwashima <kuniyu@amazon.com> 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.>
>
> ...
> > +static int proc_tcp_child_ehash_entries(struct ctl_table *table, int write,
> > + void *buffer, size_t *lenp, loff_t *ppos)
> > +{
> > + unsigned int tcp_child_ehash_entries;
> > + int ret;
> > +
> > + ret = proc_douintvec_minmax(table, write, buffer, lenp, ppos);
> > + if (!write || ret)
> > + return ret;
> > +
> > + tcp_child_ehash_entries = READ_ONCE(*(unsigned int *)table->data);
> > + if (tcp_child_ehash_entries)
> > + tcp_child_ehash_entries = roundup_pow_of_two(tcp_child_ehash_entries);
>
> This is not thread safe.
Oh, I didn't know that.
Thank you for pointing out!
>
> You could simply perform the roundup_pow_of_two() elsewhere,
> eg in tcp_set_hashinfo() (and leave the sysctl as set by the user)
Will do so and update the doc and changelog.
>
> > +
> > + WRITE_ONCE(*(unsigned int *)table->data, tcp_child_ehash_entries);
> > +
> > + return 0;
> > +}
> > +
prev parent reply other threads:[~2022-08-29 23:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-29 16:19 [PATCH v2 net-next 0/5] tcp: Introduce optional per-netns ehash Kuniyuki Iwashima
2022-08-29 16:19 ` [PATCH v2 net-next 1/5] tcp: Clean up some functions Kuniyuki Iwashima
2022-08-29 16:19 ` [PATCH v2 net-next 2/5] tcp: Set NULL to sk->sk_prot->h.hashinfo Kuniyuki Iwashima
2022-08-29 16:19 ` [PATCH v2 net-next 3/5] tcp: Access &tcp_hashinfo via net Kuniyuki Iwashima
2022-08-29 23:03 ` Eric Dumazet
2022-08-29 23:22 ` Kuniyuki Iwashima
2022-08-29 16:19 ` [PATCH v2 net-next 4/5] tcp: Save unnecessary inet_twsk_purge() calls Kuniyuki Iwashima
2022-08-29 23:11 ` Eric Dumazet
2022-08-29 23:34 ` Kuniyuki Iwashima
2022-08-30 1:49 ` Kuniyuki Iwashima
2022-08-29 16:19 ` [PATCH v2 net-next 5/5] tcp: Introduce optional per-netns ehash Kuniyuki Iwashima
2022-08-29 22:59 ` Eric Dumazet
2022-08-29 23:18 ` 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=20220829231812.19979-1-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.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 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.